Hi,
>    Is there a way, from within a servlet, to find out what the maximum
>number of processes has (maxProcessors attribute) and how many of them
are
>in use?

Yes.  The code is of course tomcat-specific, not guaranteed to work in
future tomcat versions, and the servlet must be running in a privileged
webapp (set privileged="true" for your context).  Then you'd crawl down
the tomcat container tree, e.g.:
Server server = ServerFactory.getServer();
Service service = server.findService("Catalina");
Connector[] connectors = service.findConnectors();
Etc., remaining steps are to find the connector you want, cast it to the
appropriate type (probably tomcat5 Coyote is what you have in mind), and
call getMaxProcessors.  As for how many are busy, I'm not sure at the
moment.

(All the above classes are in org.apache.catalina, the connector for
casting is org.apache.coyote.tomcat5.CoyoteConnector).  "Catalina" is
the default server.xml service name: the name in the code must match
what's in your server.xml, or alternatively you can iterate over all
services.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and 
may contain information that is confidential, proprietary and/or privileged.  This 
e-mail is intended only for the individual(s) to whom it is addressed, and may not be 
saved, copied, printed, disclosed or used by anyone else.  If you are not the(an) 
intended recipient, please immediately delete this e-mail from your computer system 
and notify the sender.  Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to