Results 1 to 1 of 1
- 09-13-2012, 05:03 PM #1
Member
- Join Date
- Sep 2012
- Posts
- 1
- Rep Power
- 0
Problem using ScheduledExecutorService in Listener contextInitialized method
Hi,
I try to run a thread (class AlertManager implements Runnable) with ScheduledExecutorService, writing this code in a Listener contextInitialized method:
When I deploy war file on Tomcat, deploy doesn't end. In catalina.log file I can read the AlertManager thread log information, replaced subsequently with the given period. But the execution of contextInitialized method doesn't end, deploy can't finish.Java Code:Runnable alertTask = new AlertManager(); ScheduledExecutorService scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(); ScheduledFuture<?> scheduledFuture = scheduledExecutorService.scheduleAtFixedRate( alertTask, 0, Keys.DB_POLLING_TIME, TimeUnit.MILLISECONDS );
If I use classic implementation, it works!
Can you help me?Java Code:Runnable runnable = new AlertManager(); Thread thread = new Thread(runnable); thread.start();
Thanks!
Similar Threads
-
How to stop ScheduledExecutorService?
By AmFreak in forum Threads and SynchronizationReplies: 19Last Post: 02-02-2012, 01:25 PM -
Key Listener problem!
By DouboC@gmail.com in forum Java AppletsReplies: 3Last Post: 01-18-2012, 01:50 AM -
Problem with key listener
By Mikelmao in forum New To JavaReplies: 1Last Post: 03-14-2011, 02:02 PM -
ScheduledExecutorService inside contextInitialized not working !!!
By xbhanu in forum Java ServletReplies: 0Last Post: 02-21-2011, 09:36 AM -
#key listener problem
By mij1_7 in forum New To JavaReplies: 2Last Post: 02-14-2009, 09:02 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks