Class MBeanImplBase
- java.lang.Object
-
- org.glassfish.admin.amx.impl.mbean.MBeanImplBase
-
- All Implemented Interfaces:
MBeanRegistration,NotificationSender
- Direct Known Subclasses:
AMXImplBase
public abstract class MBeanImplBase extends Object implements MBeanRegistration, NotificationSender
Absolute base impl class. Should contain only core functionality, nothing to do with appserver specifics.
-
-
Field Summary
Fields Modifier and Type Field Description protected static String[]EMPTY_STRING_ARRAYprotected ObjectNamemSelfObjectNameThe ObjectName by which this object is registered (if registered).protected MBeanServermServerThe MBeanServer in which this object is registered (if any)
-
Constructor Summary
Constructors Constructor Description MBeanImplBase()MBeanImplBase(MBeanServer mbeanServer)Some subclasses need the MBeanServer set in advance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Level_getMBeanLogLevel()voidaddNotificationListener(NotificationListener listener)voidaddNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)protected NotificationBuildercreateNotificationBuilder(String notificationType)protected voiddebug(Object o)protected voiddebug(Object... args)protected voiddebugMethod(String methodName, Object... args)protected voiddebugMethod(String msg, String methodName, Object... args)booleanenableAMXDebug(boolean enabled)booleangetAMXDebug()Although unusual, a subclass may override the debug state.protected StringgetDebugID()protected OutputgetDebugOutput()StringgetJMXDomain()intgetListenerCount()protected LoggergetMBeanLogger()StringgetMBeanLoggerName()StringgetMBeanLogLevel()protected intgetMBeanLogLevelInt()MBeanServergetMBeanServer()protected NotificationBuildergetNotificationBuilder(String notificationType)Get a NotificationBuilder for the specified type of Notification whose source is this object.protected NotificationEmitterSupportgetNotificationEmitter()intgetNotificationTypeListenerCount(String type)ObjectNamegetObjectName()protected voidlogFine(Object o)protected voidlogFiner(Object o)protected voidlogFinest(Object o)protected voidlogInfo(Object o)protected voidlogSevere(Object o)protected voidlogWarning(Object o)voidpostDeregister()protected voidpostDeregisterHook()voidpostRegister(Boolean registrationSucceeded)protected voidpostRegisterHook(Boolean registrationSucceeded)voidpreDeregister()protected voidpreDeregisterHook()ObjectNamepreRegister(MBeanServer server, ObjectName nameIn)protected static Stringquote(Object o)voidremoveNotificationListener(NotificationListener listener)voidremoveNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)protected voidsendNotification(String notificationType)Send a Notification of the specified type containing no data.protected voidsendNotification(String notificationType, String key, Serializable value)Send a Notification of the specified type containing a single key/value pair for data.protected voidsendNotification(String notificationType, String message, String key, Serializable value)Send a Notification of the specified type containing a single key/value pair for data.voidsendNotification(Notification notification)voidsetAMXDebug(boolean debug)voidsetMBeanLogLevel(String level)protected booleanshouldOmitObjectNameForDebug()protected static StringtoString(Object o)protected voidtrace(Object o)
-
-
-
Field Detail
-
EMPTY_STRING_ARRAY
protected static final String[] EMPTY_STRING_ARRAY
-
mServer
protected volatile MBeanServer mServer
The MBeanServer in which this object is registered (if any)
-
mSelfObjectName
protected volatile ObjectName mSelfObjectName
The ObjectName by which this object is registered (if registered). Multiple registrations, which are possible, overwrite this; the last registration wins. If the MBean has not been registered, this name will be null.
-
-
Constructor Detail
-
MBeanImplBase
public MBeanImplBase()
-
MBeanImplBase
public MBeanImplBase(MBeanServer mbeanServer)
Some subclasses need the MBeanServer set in advance.
-
-
Method Detail
-
getListenerCount
public final int getListenerCount()
-
getNotificationTypeListenerCount
public final int getNotificationTypeListenerCount(String type)
-
getNotificationEmitter
protected final NotificationEmitterSupport getNotificationEmitter()
- Returns:
- an empty array Subclass may wish to override this.
-
addNotificationListener
public void addNotificationListener(NotificationListener listener)
-
addNotificationListener
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
-
removeNotificationListener
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException
- Throws:
ListenerNotFoundException
-
removeNotificationListener
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException
- Throws:
ListenerNotFoundException
-
sendNotification
public void sendNotification(Notification notification)
- Specified by:
sendNotificationin interfaceNotificationSender
-
createNotificationBuilder
protected NotificationBuilder createNotificationBuilder(String notificationType)
-
getNotificationBuilder
protected NotificationBuilder getNotificationBuilder(String notificationType)
Get a NotificationBuilder for the specified type of Notification whose source is this object.
-
sendNotification
protected void sendNotification(String notificationType)
Send a Notification of the specified type containing no data.
-
sendNotification
protected void sendNotification(String notificationType, String key, Serializable value)
Send a Notification of the specified type containing a single key/value pair for data.
-
sendNotification
protected void sendNotification(String notificationType, String message, String key, Serializable value)
Send a Notification of the specified type containing a single key/value pair for data.
-
getObjectName
public final ObjectName getObjectName()
-
getJMXDomain
public String getJMXDomain()
-
getMBeanServer
public final MBeanServer getMBeanServer()
-
trace
protected final void trace(Object o)
-
logSevere
protected final void logSevere(Object o)
-
logWarning
protected final void logWarning(Object o)
-
logInfo
protected final void logInfo(Object o)
-
logFine
protected final void logFine(Object o)
-
logFiner
protected final void logFiner(Object o)
-
logFinest
protected final void logFinest(Object o)
-
getMBeanLogger
protected final Logger getMBeanLogger()
-
_getMBeanLogLevel
protected final Level _getMBeanLogLevel()
-
getMBeanLogLevel
public final String getMBeanLogLevel()
-
setMBeanLogLevel
public final void setMBeanLogLevel(String level)
-
getMBeanLogLevelInt
protected final int getMBeanLogLevelInt()
-
getMBeanLoggerName
public final String getMBeanLoggerName()
-
preRegister
public ObjectName preRegister(MBeanServer server, ObjectName nameIn) throws Exception
- Specified by:
preRegisterin interfaceMBeanRegistration- Throws:
Exception
-
postRegisterHook
protected void postRegisterHook(Boolean registrationSucceeded)
-
postRegister
public final void postRegister(Boolean registrationSucceeded)
- Specified by:
postRegisterin interfaceMBeanRegistration
-
preDeregister
public final void preDeregister() throws Exception- Specified by:
preDeregisterin interfaceMBeanRegistration- Throws:
Exception
-
postDeregisterHook
protected void postDeregisterHook()
-
postDeregister
public final void postDeregister()
- Specified by:
postDeregisterin interfaceMBeanRegistration
-
getDebugID
protected String getDebugID()
-
getAMXDebug
public final boolean getAMXDebug()
Although unusual, a subclass may override the debug state. Generally it is faster to NOT call getAMXDebug() before calling debug( x ) if 'x' is just a string. If it is expensive to construct 'x', then preflighting with getAMXDebug() may be worthwhile.
-
enableAMXDebug
public boolean enableAMXDebug(boolean enabled)
-
getDebugOutput
protected Output getDebugOutput()
-
setAMXDebug
public final void setAMXDebug(boolean debug)
-
shouldOmitObjectNameForDebug
protected boolean shouldOmitObjectNameForDebug()
-
debug
protected final void debug(Object o)
-
debug
protected void debug(Object... args)
-
-