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_ARRAY
protected ObjectName
mSelfObjectName
The ObjectName by which this object is registered (if registered).protected MBeanServer
mServer
The 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()
void
addNotificationListener(NotificationListener listener)
void
addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
protected NotificationBuilder
createNotificationBuilder(String notificationType)
protected void
debug(Object o)
protected void
debug(Object... args)
protected void
debugMethod(String methodName, Object... args)
protected void
debugMethod(String msg, String methodName, Object... args)
boolean
enableAMXDebug(boolean enabled)
boolean
getAMXDebug()
Although unusual, a subclass may override the debug state.protected String
getDebugID()
protected Output
getDebugOutput()
String
getJMXDomain()
int
getListenerCount()
protected Logger
getMBeanLogger()
String
getMBeanLoggerName()
String
getMBeanLogLevel()
protected int
getMBeanLogLevelInt()
MBeanServer
getMBeanServer()
protected NotificationBuilder
getNotificationBuilder(String notificationType)
Get a NotificationBuilder for the specified type of Notification whose source is this object.protected NotificationEmitterSupport
getNotificationEmitter()
int
getNotificationTypeListenerCount(String type)
ObjectName
getObjectName()
protected void
logFine(Object o)
protected void
logFiner(Object o)
protected void
logFinest(Object o)
protected void
logInfo(Object o)
protected void
logSevere(Object o)
protected void
logWarning(Object o)
void
postDeregister()
protected void
postDeregisterHook()
void
postRegister(Boolean registrationSucceeded)
protected void
postRegisterHook(Boolean registrationSucceeded)
void
preDeregister()
protected void
preDeregisterHook()
ObjectName
preRegister(MBeanServer server, ObjectName nameIn)
protected static String
quote(Object o)
void
removeNotificationListener(NotificationListener listener)
void
removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
protected void
sendNotification(String notificationType)
Send a Notification of the specified type containing no data.protected void
sendNotification(String notificationType, String key, Serializable value)
Send a Notification of the specified type containing a single key/value pair for data.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.void
sendNotification(Notification notification)
void
setAMXDebug(boolean debug)
void
setMBeanLogLevel(String level)
protected boolean
shouldOmitObjectNameForDebug()
protected static String
toString(Object o)
protected void
trace(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:
sendNotification
in 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:
preRegister
in interfaceMBeanRegistration
- Throws:
Exception
-
postRegisterHook
protected void postRegisterHook(Boolean registrationSucceeded)
-
postRegister
public final void postRegister(Boolean registrationSucceeded)
- Specified by:
postRegister
in interfaceMBeanRegistration
-
preDeregister
public final void preDeregister() throws Exception
- Specified by:
preDeregister
in interfaceMBeanRegistration
- Throws:
Exception
-
postDeregisterHook
protected void postDeregisterHook()
-
postDeregister
public final void postDeregister()
- Specified by:
postDeregister
in 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)
-
-