• hessian
  • quercus/php
  • resin 3.0
  • resin 3.1
  • resin 4.0

  • changes
  • configuration
  • examples
  • installing
  • overview
  • starting

  • guide: admin
  • admin
  • amber
  • bam
  • caching
  • clustering
  • comet
  • database
  • deployment
  • ejb 3.0
  • embedding
  • filters
  • ioc
  • jsf
  • jsp
  • logging
  • messaging
  • quercus
  • remoting
  • security
  • resources
  • servlets
  • third-party
  • troubleshooting
  • virtual host
  • watchdog
  • webapp
  • HOME
  • ABOUT
  • ARTICLES
  • WORKSPACE
  • NEWS
  • PROJECTS
  • PRODUCTS
  • STORE
resin

The facilities of JMX are a convenient way to provide an administration interface to objects and components in web applications.

The domain is web-app, the type property is javax.servlet.Servlet and the name property is the value of <servlet-name>.

JMX clients will use the name to manage the servlet. For example, a client might use the pattern web-app:type=javax.servlet.Servlet,* to retrieve all managed servlets.

package test; public interface MyServletMBean { public int getCount(); } package test; import java.io.*; import javax.servlet.*; public class MyServlet extends GenericServlet implements MyServletMBean { private int count; public int getCount() { return count; } public void service(ServletRequest request, ServletResponse response) throws IOException { PrintWriter out = response.getWriter(); count++; out.println("Hello, world"); } }

Managing resources uses the JMX API, primarily using the MBeanServer object. In Resin, each web-app has its own MBeanServer.

import javax.management.*; ... MBeanServer server = MBeanServerFactory.createMBeanServer(); ObjectName name = new ObjectName("web-app:j2eeType=javax.servlet.Servlet," + "name=hello"); Object value = server.getAttribute(name, "Count"); out.println("Count: " + value);

The resin-status servlet has a primitive generic JMX management view of JMX managed servlets. By adding a MBean interface to your servlet, you'll automatically get a view of your servlets from /resin-status.

  • HOME |
  • CONTACT US |
  • DOCUMENTATION |
  • SALES |
  • WIKI
Copyright (c) 1998-2009 Caucho Technology, Inc. All rights reserved.
caucho® , resin® and quercus® are registered trademarks of Caucho Technology, Inc.
  • hessian
  • quercus/php
  • resin 3.0
  • resin 3.1
  • resin 4.0

  • changes
  • configuration
  • examples
  • installing
  • overview
  • starting

  • guide: admin
  • admin
  • amber
  • bam
  • caching
  • clustering
  • comet
  • database
  • deployment
  • ejb 3.0
  • embedding
  • filters
  • ioc
  • jsf
  • jsp
  • logging
  • messaging
  • quercus
  • remoting
  • security
  • resources
  • servlets
  • third-party
  • troubleshooting
  • virtual host
  • watchdog
  • webapp
  • HOME
  • ABOUT
  • ARTICLES
  • WORKSPACE
  • NEWS
  • PROJECTS
  • PRODUCTS
  • STORE

Instrumenting resources so JMX can manage them consists of the following steps:

  1. For a class MyFoo, create an interface MyFooMBean with the management interface.
  2. Class MyFoo needs to implement the MyFooMBean interface.
  3. Register MyFoo with the JMX server.

Resin will automatically register any servlet which implement an MBean interface. By default, the JMX name will be:

web-app:j2eeType=Servlet,name=servlet-name
AttributeValue
j2eeTypeServlet
WebModulethe contextPath
J2EEApplicationthe host?
J2EEServerthe server-id?
  • HOME |
  • CONTACT US |
  • DOCUMENTATION |
  • SALES |
  • WIKI
Copyright (c) 1998-2009 Caucho Technology, Inc. All rights reserved.
caucho® , resin® and quercus® are registered trademarks of Caucho Technology, Inc.