ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(4);
for (int i = 0; i < 4; i++)
{Runnable autoUpdate = new autoUpdateWork(i);
ScheduledFuture<?> scheduleAtFixedRate = scheduler.scheduleAtFixedRate(autoUpdate, 0, 60, TimeUnit.SECONDS);
}
if (scheduleAtFixedRate != null)
{
while(!scheduleAtFixedRate.isDone())
//wait...
}
//PointA :until all threads are finished, do sth, then invoke the scheduled task with 60 sec interval again.
위 코드는 내 코드입니다. 하지만 PointA에 도달하지 못할 것 같습니다 .. 도와주세요, 고마워요! 대신의 Runnable 클래스에서 Java 예약 Executor 서비스가 완료 될 때까지 모든 스레드 대기
if (scheduleAtFixedRate != null)
{
while(!scheduleAtFixedRate.isDone())
//wait...
}
을하는
마지막으로 다른 실행 가능한 클래스로 실행 가능한 클래스를 래핑하는 방식으로 수행했습니다. 어쨌든 도움을 주셔서 감사합니다. – zenalan