users@glassfish.java.net

WorkManager queue size

From: FredrikJ <fredrik_at_robotsociety.com>
Date: Tue, 21 Apr 2009 08:28:22 -0700 (PDT)

Hi.
I have been looking at using the WorkManager API to execute HTTP requests
asynchronously. The hand-off and everything works like a champ, but now I am
interested in checking the queue size of the WorkManager. If the queue size
is bigger than a certain limit I want to fail fast rather than to pile up
request on the thread pool.

So. Basically I'm getting my WorkManager like this:
CommonWorkManager workManager =
(CommonWorkManager)WorkManagerFactory.getWorkManager(threadpool);

But when I try to access any statistical methods, like this:
long queueSize = workManager.getWaitQueueength();
I get NullPointers.

I have set monitoring service for 'Thread Pool' in glassfish to HIGH. I can
see the statistics in the glassfish admin interface and through JMX.

I have tried to set the monitoring flag directly in my code like this:
workManager.setMonitoringEnabled(true);

That fixes the NullPointers, but now I get zeros only. I am suspecting this
may be incorrect usage, but anyway. I see the stats increasing (queue-size
etc) when applying load, but only in the admin & JMX, never in my
application.

So, my question is: Does anyone know how to got the queue size of a
WorkManager in Glassfish programmatically?

It seems like such a waste to have to go through JMX just to get the size of
the underlying queue in the thread pool.






-- 
View this message in context: http://www.nabble.com/WorkManager-queue-size-tp23158627p23158627.html
Sent from the java.net - glassfish users mailing list archive at Nabble.com.