Hi,
I was just playing with the correct jmx properties. My purpose is to see what
are the maximum requests and watch the health of my servers.
MBeanServerConnection mbs = jmxpool.getConnection(host);
ObjectName query = new
ObjectName("Catalina:type=RequestProcessor,worker=*,name=*");
Set<ObjectInstance> set;
try {
set = mbs.queryMBeans(query, null);
} catch (Exception e) {
continue;
}
for (ObjectInstance inst : set) {
Integer cnt = (Integer) mbs.getAttribute(inst.getObjectName(),
"requestCount");
if (cnt == 0) continue;
String name = inst.getObjectName().getKeyProperty("worker") +
"/" + inst.getObjectName().getKeyProperty("name");
// I haven't tried the following parameters, but this what is
there in jconsole.
String currentUri = (String)
mbs.getAttribute(inst.getObjectName(), "currentUri");
String currentQueryString = (String)
mbs.getAttribute(inst.getObjectName(), "currentQueryString");
Long sent = (Long) mbs.getAttribute(inst.getObjectName(),
"requestBytesSent");
Long received = (Long) mbs.getAttribute(inst.getObjectName(),
"requestBytesReceived");
Long total = (Long) mbs.getAttribute(inst.getObjectName(),
"requestProcessingTime");
// Do whatever you want.
}
Good luck.
Regards,
Dave
On Oct 21, 2010, at 1:58 PM, Ruslan Gainutdinov wrote:
> Hello!
>
> Is there any JMX property which indicates no requests is being processed, and
> no requests are waiting in the queue?
>
> I am trying to develop a way to gracefully shutdown tomcat as part of
> mod_jk cluster.
>
> Because requests can be long (up to 1 hour) and must be successfully
> processed,
> there must be separate way to ensure no requests are in queue before
> shutting down server.
>
> With kindest personal regards,
> Ruslan Gainutdinov
> <[email protected]>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]