FileDocCategorySizeDatePackage
AppServerMBeanServerBuilder.javaAPI DocGlassfish v2 API8625Fri May 04 22:33:48 BST 2007com.sun.enterprise.admin.server.core.jmx

AppServerMBeanServerBuilder

public class AppServerMBeanServerBuilder extends MBeanServerBuilder
AppServer MBSBuilder for PE set as the value for javax.management.initial.builder in the environment. This builder extends from javax.management.MBeanServerBuilder and creates MBS with app server interceptors based on a flag. This flag can only be turned in this package and is called by the AppServerMBeanServerFactory.
author
sridatta

Fields Summary
private static final MBeanServerBuilder
defaultBuilder
protected static final Logger
_logger
private static MBeanServer
_defaultMBeanServer
Constructors Summary
public AppServerMBeanServerBuilder()
Creates a new instance of MBeanServerBuilder

    
           
      
    
Methods Summary
protected static javax.management.MBeanServerBuildergetDefaultBuilder()
jmx ri default builder

        return defaultBuilder;
    
protected javax.management.MBeanServernewAppServerMBeanServer(java.lang.String defaultDomain, javax.management.MBeanServerDelegate delegate)
creates a jmx MBeanServer creates a AppServerInterceptor and sets the jmx mbean server to it. It then wraps any additional interceptors (nothing for PE) Note that the "outer" is SunoneInterceptor and not the additional interceptors added in addInterceptor. (commented out for now for testing purposes. Need to comeback to this. FIXME.) returns AppServerMBS

        // we cannot yet create the SunoneInterceptor; it will be inserted
        // later by the AdminService
        final DynamicInterceptor result = new DynamicInterceptor();
        final MBeanServer jmxMBS = defaultBuilder.newMBeanServer(
            defaultDomain, result, delegate);
        result.setDelegateMBeanServer( jmxMBS );
               
        return result;
     
public javax.management.MBeanServernewMBeanServer(java.lang.String defaultDomain, javax.management.MBeanServer outer, javax.management.MBeanServerDelegate delegate)
This method creates a new MBeanServer implementation object. When creating a new MBeanServer the MBeanServerFactory first calls newMBeanServerDelegate() in order to obtain a new MBeanServerDelegate for the new MBeanServer. Then it calls newMBeanServer(defaultDomain,outer,delegate) passing the delegate that should be used by the MBeanServer implementation. Note that the passed delegate might not be directly the MBeanServerDelegate that was returned by this implementation. It could be, for instance, a new object wrapping the previously returned delegate. The outer parameter is a pointer to the MBeanServer that should be passed to the MBeanRegistration interface when registering MBeans inside the MBeanServer. If outer is null, then the MBeanServer implementation must use its own this reference when invoking the MBeanRegistration interface. This makes it possible for a MBeanServer implementation to wrap another MBeanServer implementation, in order to implement, e.g, security checks, or to prevent access to the actual MBeanServer implementation by returning a pointer to a wrapping object. Parameters: defaultDomain - Default domain of the new MBeanServer. outer - A pointer to the MBeanServer object that must be passed to the MBeans when invoking their MBeanRegistration interface. delegate - A pointer to the MBeanServerDelegate associated with the new MBeanServer. The new MBeanServer must register this MBean in its MBean repository. Returns: A new private implementation of an MBeanServer. Note that this method is sychronized on the class for the case when user requests an MBS during creation on Sun's mbs. This can seldom happen but needs to be a safe code.

                                                  
        MBeanServer mbeanServer = null;             
        synchronized (AppServerMBeanServerBuilder.class) {
            /*
                We *must* create the first MBeanServer as our special one.  Later MBeanServers
                can be the standard JMX one.  
             */
            if ( _defaultMBeanServer == null ) {   // first time
                mbeanServer = newAppServerMBeanServer(defaultDomain, delegate);
                _defaultMBeanServer = mbeanServer;
            }
            else {
                mbeanServer = defaultBuilder.newMBeanServer(
                    defaultDomain, outer,  delegate);
            }
        }
        _logger.log(Level.FINE, "MBeanServer class = " +
            mbeanServer.getClass().getName() );

        return mbeanServer;
     
public javax.management.MBeanServerDelegatenewMBeanServerDelegate()
This method creates a new MBeanServerDelegate for a new MBeanServer. When creating a new MBeanServer the MBeanServerFactory first calls this method in order to create a new MBeanServerDelegate. Then it calls newMBeanServer(defaultDomain,outer,delegate) passing the delegate that should be used by the MBeanServer implementation. Note that the passed delegate might not be directly the MBeanServerDelegate that was returned by this method. It could be, for instance, a new object wrapping the previously returned object. return the MBeanServerDelegate from jmx defaultBuilder

        return defaultBuilder.newMBeanServerDelegate();