public class ServiceMBeanSupport extends NotificationBroadcasterSupport implements ServiceMBean, MBeanRegistration
getName() method and should override startService(), and stopService() as
approriate.ServiceMBean| Modifier and Type | Field and Description |
|---|---|
protected Logger |
log |
protected MBeanServer |
server
The MBeanServer which we have been register with.
|
protected ObjectName |
serviceName
The object name which we are registered under.
|
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED| Constructor and Description |
|---|
ServiceMBeanSupport()
Construct a
|
ServiceMBeanSupport(Class<?> type)
Construct a
|
ServiceMBeanSupport(Logger log)
Construct a
|
ServiceMBeanSupport(String category)
Construct a
|
| Modifier and Type | Method and Description |
|---|---|
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.
|
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 ObjectName |
getObjectName(MBeanServer server,
ObjectName name)
Sub-classes should override this method if they only need to set their object name during MBean pre-registration.
|
MBeanServer |
getServer() |
ObjectName |
getServiceName() |
int |
getState() |
String |
getStateString() |
protected void |
jbossInternalCreate() |
protected String |
jbossInternalDescription() |
protected void |
jbossInternalDestroy() |
void |
jbossInternalLifecycle(String method)
Detyped lifecycle invocation
|
protected void |
jbossInternalStart() |
protected void |
jbossInternalStop() |
long |
nextNotificationSequenceNumber()
The
nextNotificationSequenceNumber method returns the next sequence number for use in notifications. |
void |
postDeregister() |
void |
postRegister(Boolean registrationDone) |
void |
preDeregister() |
ObjectName |
preRegister(MBeanServer server,
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.
|
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotificationprotected Logger log
protected MBeanServer server
protected ObjectName serviceName
public ServiceMBeanSupport()
Sets up logging.
public ServiceMBeanSupport(Class<?> type)
Sets up logging.
type - The class type to determine category name from.public ServiceMBeanSupport(String category)
Sets up logging.
category - The logger category name.public ServiceMBeanSupport(Logger log)
log - The logger to use.public String getName()
getName in interface ServiceMBeanpublic ObjectName getServiceName()
public MBeanServer getServer()
public int getState()
getState in interface ServiceMBeanpublic String getStateString()
getStateString in interface ServiceMBeanpublic Logger getLog()
public void create()
throws Exception
Servicepublic void start()
throws Exception
Servicepublic void stop()
Servicepublic void destroy()
Serviceprotected String jbossInternalDescription()
public void jbossInternalLifecycle(String method) throws Exception
ServiceMBeanjbossInternalLifecycle in interface ServiceMBeanExceptionprotected void jbossInternalStop()
protected void jbossInternalDestroy()
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception
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.
preRegister in interface MBeanRegistrationserver - Reference to the JMX Agent this MBean is registered onname - 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).Exception - for any errorpublic void postRegister(Boolean registrationDone)
postRegister in interface MBeanRegistrationpublic void preDeregister()
throws Exception
preDeregister in interface MBeanRegistrationExceptionpublic void postDeregister()
postDeregister in interface MBeanRegistrationprotected ObjectName getObjectName(MBeanServer server, ObjectName name) throws MalformedObjectNameException
server - the mbeanservername - the suggested name, maybe nullMalformedObjectNameException - for a bad object nameprotected void createService()
throws Exception
This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.
Exception - for any errorprotected void startService()
throws Exception
This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.
Exception - for any errorprotected void stopService()
throws Exception
This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.
Exception - for any errorprotected void destroyService()
throws Exception
This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.
Exception - for any errorpublic long nextNotificationSequenceNumber()
nextNotificationSequenceNumber method returns the next sequence number for use in notifications.long valueprotected long getNextNotificationSequenceNumber()
getNextNotificationSequenceNumber method returns the next sequence number for use in notifications.long valueCopyright © 2018 JBoss by Red Hat. All rights reserved.