站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 4.0.1 sp1 system API Documentation 英文版文档

ServiceMBeanSupport (JBoss System API) - JBoss 4.0.1 sp1 system API Documentation 英文版文档


org.jboss.system
Class ServiceMBeanSupport

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended byorg.jboss.system.ServiceMBeanSupport
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, Service, ServiceMBean
Direct Known Subclasses:
AbstractDeploymentScanner, AttributePersistenceService, ClasspathExtension, DeploymentCache, FileDeploymentStore, ListenerServiceMBeanSupport, MainDeployer, ServiceDynamicMBeanSupport, SubDeployerSupport

public class ServiceMBeanSupport
extends org.jboss.mx.util.JBossNotificationBroadcasterSupport
implements ServiceMBean, javax.management.MBeanRegistration

An abstract base class JBoss services can subclass to implement a service that conforms to the ServiceMBean interface. Subclasses must override getName() method and should override startService(), and stopService() as approriate.

Version:
$Revision: 1.23.6.1 $
Author:
Rickard 脰berg, Scott.Stark@jboss.org, Andreas Schaefer, Jason Dillon
See Also:
ServiceMBean

Field Summary
protected  org.jboss.logging.Logger log
          The instance logger for the service.
protected  javax.management.MBeanServer server
          The MBeanServer which we have been register with.
static String[] SERVICE_CONTROLLER_SIG
          The signature for service controller operations
protected  javax.management.ObjectName serviceName
          The object name which we are registsred under.
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
ServiceMBeanSupport()
          Construct a ServiceMBeanSupport.
ServiceMBeanSupport(Class type)
          Construct a ServiceMBeanSupport.
ServiceMBeanSupport(org.jboss.logging.Logger log)
          Construct a ServiceMBeanSupport.
ServiceMBeanSupport(String category)
          Construct a ServiceMBeanSupport.
 
Method Summary
 void create()
          create the service, do expensive operations etc
protected  void createService()
          Sub-classes should override this method to provide custum 'create' logic.
 void destroy()
          destroy the service, tear down
protected  void destroyService()
          Sub-classes should override this method to provide custum 'destroy' logic.
 org.jboss.logging.Logger getLog()
           
 String getName()
          Use the short class name as the default for the service name.
protected  long getNextNotificationSequenceNumber()
          The getNextNotificationSequenceNumber method returns the next sequence number for use in notifications.
protected  javax.management.ObjectName getObjectName(javax.management.MBeanServer server, javax.management.ObjectName name)
          Sub-classes should override this method if they only need to set their object name during MBean pre-registration.
 javax.management.MBeanServer getServer()
           
 javax.management.ObjectName getServiceName()
           
 int getState()
           
 String getStateString()
           
protected  void jbossInternalCreate()
           
protected  String jbossInternalDescription()
           
 void jbossInternalDestroy()
           
 void jbossInternalLifecycle(String method)
          Detyped lifecycle invocation
 void jbossInternalStart()
           
 void jbossInternalStop()
           
 void postDeregister()
           
 void postRegister(Boolean registrationDone)
           
 void preDeregister()
           
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
          Callback method of MBeanRegistration before the MBean is registered at the JMX Agent.
 void start()
          start the service, create is already called
protected  void startService()
          Sub-classes should override this method to provide custum 'start' logic.
 void stop()
          stop the service
protected  void stopService()
          Sub-classes should override this method to provide custum 'stop' logic.
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_CONTROLLER_SIG

public static final String[] SERVICE_CONTROLLER_SIG
The signature for service controller operations


log

protected org.jboss.logging.Logger log
The instance logger for the service. Not using a class logger because we want to dynamically obtain the logger name from concreate sub-classes.


server

protected javax.management.MBeanServer server
The MBeanServer which we have been register with.


serviceName

protected javax.management.ObjectName serviceName
The object name which we are registsred under.

Constructor Detail

ServiceMBeanSupport

public ServiceMBeanSupport()
Construct a ServiceMBeanSupport.

Sets up logging.


ServiceMBeanSupport

public ServiceMBeanSupport(Class type)
Construct a ServiceMBeanSupport.

Sets up logging.

Parameters:
type - The class type to determine category name from.

ServiceMBeanSupport

public ServiceMBeanSupport(String category)
Construct a ServiceMBeanSupport.

Sets up logging.

Parameters:
category - The logger category name.

ServiceMBeanSupport

public ServiceMBeanSupport(org.jboss.logging.Logger log)
Construct a ServiceMBeanSupport.

Parameters:
log - The logger to use.
Method Detail

getName

public String getName()
Use the short class name as the default for the service name.

Specified by:
getName in interface ServiceMBean

getServiceName

public javax.management.ObjectName getServiceName()

getServer

public javax.management.MBeanServer getServer()

getState

public int getState()
Specified by:
getState in interface ServiceMBean

getStateString

public String getStateString()
Specified by:
getStateString in interface ServiceMBean

getLog

public org.jboss.logging.Logger getLog()

create

public void create()
            throws Exception
Description copied from interface: Service
create the service, do expensive operations etc

Specified by:
create in interface Service
Throws:
Exception

start

public void start()
           throws Exception
Description copied from interface: Service
start the service, create is already called

Specified by:
start in interface Service
Throws:
Exception

stop

public void stop()
Description copied from interface: Service
stop the service

Specified by:
stop in interface Service

destroy

public void destroy()
Description copied from interface: Service
destroy the service, tear down

Specified by:
destroy in interface Service

jbossInternalDescription

protected String jbossInternalDescription()

jbossInternalLifecycle

public void jbossInternalLifecycle(String method)
                            throws Exception
Description copied from interface: ServiceMBean
Detyped lifecycle invocation

Specified by:
jbossInternalLifecycle in interface ServiceMBean
Throws:
Exception

jbossInternalCreate

protected void jbossInternalCreate()
                            throws Exception
Throws:
Exception

jbossInternalStart

public void jbossInternalStart()
                        throws Exception
Throws:
Exception

jbossInternalStop

public void jbossInternalStop()

jbossInternalDestroy

public void jbossInternalDestroy()

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName name)
                                        throws Exception
Callback method of MBeanRegistration before the MBean is registered at the JMX Agent.

Attention: Always call this method when you overwrite it in a subclass because it saves the Object Name of the MBean.

Specified by:
preRegister in interface javax.management.MBeanRegistration
Parameters:
server - Reference to the JMX Agent this MBean is registered on
name - Name specified by the creator of the MBean. Note that you can overwrite it when the given ObjectName is null otherwise the change is discarded (maybe a bug in JMX-RI).
Throws:
Exception

postRegister

public void postRegister(Boolean registrationDone)
Specified by:
postRegister in interface javax.management.MBeanRegistration

preDeregister

public void preDeregister()
                   throws Exception
Specified by:
preDeregister in interface javax.management.MBeanRegistration
Throws:
Exception

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface javax.management.MBeanRegistration

getNextNotificationSequenceNumber

protected long getNextNotificationSequenceNumber()
The getNextNotificationSequenceNumber method returns the next sequence number for use in notifications.

Returns:
a long value

getObjectName

protected javax.management.ObjectName getObjectName(javax.management.MBeanServer server,
                                                    javax.management.ObjectName name)
                                             throws javax.management.MalformedObjectNameException
Sub-classes should override this method if they only need to set their object name during MBean pre-registration.

Throws:
javax.management.MalformedObjectNameException

createService

protected void createService()
                      throws Exception
Sub-classes should override this method to provide custum 'create' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Throws:
Exception

startService

protected void startService()
                     throws Exception
Sub-classes should override this method to provide custum 'start' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Throws:
Exception

stopService

protected void stopService()
                    throws Exception
Sub-classes should override this method to provide custum 'stop' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Throws:
Exception

destroyService

protected void destroyService()
                       throws Exception
Sub-classes should override this method to provide custum 'destroy' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Throws:
Exception


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.