tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Leon Rosenberg <rosenberg.l...@gmail.com>
Subject How to start a daemon without getting the warning?
Date Wed, 27 Oct 2010 20:10:36 GMT
Hello,

I'm getting following warning with 6.0.29,

after shutdown:
SEVERE: The web application [/moskitodemo] appears to have started a
thread named [MoskitoMemoryPoolReader] but has failed to stop it. This
is very likely to create a memory leak.

here's the snapshot of the code that starts the thread:


public class BuiltInMemoryPoolProducer implements IStatsProducer{

	/**
	 * Timer instance for this producer type.
	 */
	private static final Timer timer = new Timer("MoskitoMemoryPoolReader", true);

...

	public BuiltInMemoryPoolProducer(MemoryPoolMXBean aPool){

		timer.scheduleAtFixedRate(new TimerTask() {
			@Override
			public void run() {
				readMemory();
			}
		}, 0, 1000L*60);
...}

to my knowledge this thread is a daemon. This knowledge is also shared
by jstack:


"MoskitoMemoryPoolReader" daemon prio=5 tid=10883f800 nid=0x11a9b2000
in Object.wait() [11a9b1000]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <10a1120d0> (a java.util.TaskQueue)
	at java.util.TimerThread.mainLoop(Timer.java:509)
	- locked <10a1120d0> (a java.util.TaskQueue)
	at java.util.TimerThread.run(Timer.java:462)

So, how can I avoid this warning and where's the bug.

regards
Leon

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message