我的安排線程池--->爪哇 - 線程池
private static ScheduledExecutorService pendingCheckScheduler = Executors.newScheduledThreadPool(1);
線程1 --->
private ScheduledFuture<?> pendingTranStatusCheckHandle=pendingCheckScheduler.scheduleAtFixedRate(new PendingTranStatusCheck(),0,checkForPendingTrans,TimeUnit.SECONDS);
線程2 --->
private ScheduledFuture<?> forcibleBatchCloseHandle=pendingCheckScheduler.schedule(new ForcibleBatchClose(), waitForPendingTrans, TimeUnit.MINUTES);
Thread 1
正在執行每10秒鐘一次。 Thread 2
應該在30分鐘後啓動。
Thread 1
表現如預期那樣,預計在30分鐘後開始的Thread2
在1小時後開始。
是否在thread1
延遲是造成這個問題嗎?如果是這樣,thread2
是應該givcen當線程1點結束考慮到我們有螺紋pool.Why Thread2
只有一個線程被拉伸過長後1小時開始優先?
我很笨,期待一些指針。請幫助我。
你應該使用代碼塊代碼。排除「線程1 - >」使其成爲評論的東西。另外一個換行符可以幫助提高可讀性。 – luksch 2013-04-25 08:58:43
好的,我會按照你的指示在我的下一篇文章中。不知何故,我忘了。 – sskumar86 2013-04-25 10:43:02