08/08/13 21:14:07
>>115
縮めてみた。
import java.util.*;
import java.util.concurrent.*;
import java.text.SimpleDateFormat;
public class TestA implements Callable<Object> {
private ScheduledFuture<?> future;
private ScheduledThreadPoolExecutor pool = (ScheduledThreadPoolExecutor)Executors.newScheduledThreadPool(1);
public static void main(String[] argv) {new TestA().start();}
public void start() {future = pool.schedule(this, 1, TimeUnit.MILLISECONDS);}
public Object call() throws Exception {
System.out.println(sdf.format(new Date()) + ": running");
ScheduledFuture<?> future2 = pool.schedule(this, 1, TimeUnit.MILLISECONDS);
return future;
}
SimpleDateFormat sdf = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss" , Locale.JAPAN);
}
遅延を0にすればとまらないのだから、デッドロックと言うことは無いだろう。
時刻に達したら制止が外れるようなので、
1,2秒さかのぼった程度なら、問題にならないだろうけど、
夏時間とかはどうなるだろ。
また、時計を巻き戻して、処理が止まってから、時計を戻してみた。
すると、1分間ほど経ってから処理が再開した。