我的安排线程池--->爪哇 - 线程池
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