public class LoggerBroadcaster extends javax.management.NotificationBroadcasterSupport implements javax.management.MBeanRegistration, LoggerBroadcasterMBean
Simply register this MBean in the MBeanServer, register one or more listener (eventually with filters
on the notification type), then call (directly or through MBeanServer) one of the start
operations. From this moment, MX4J internal logging is redirected to this MBean, and from here to all registered
listeners, basing on their filters.
Modifier and Type | Class and Description |
---|---|
static class |
LoggerBroadcaster.LoggerNotifier |
Constructor and Description |
---|
LoggerBroadcaster() |
Modifier and Type | Method and Description |
---|---|
protected Logger |
createLoggerPrototype() |
javax.management.MBeanNotificationInfo[] |
getNotificationInfo()
Returns the metadata information associated with this emitter.
|
void |
postDeregister()
Callback called just after the MBean has been successfully unregistered.
|
void |
postRegister(java.lang.Boolean registrationDone)
Callback called just after the MBean has been registered (successfully or not).
|
void |
preDeregister()
Callback called just before MBean unregistration from the MBeanServer.
|
javax.management.ObjectName |
preRegister(javax.management.MBeanServer server,
javax.management.ObjectName name)
Callback called just before MBean registration in the MBeanServer.
|
void |
removeNotificationListener(javax.management.NotificationListener listener,
javax.management.NotificationFilter filter,
java.lang.Object handback)
Removes a notification listener from this MBean.
|
void |
sendNotification(javax.management.Notification n)
Sends the given notification to all registered listeners
|
void |
start() |
void |
start(java.lang.String category) |
void |
stop() |
void |
stop(java.lang.String category) |
addNotificationListener, handleNotification, removeNotificationListener
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addNotificationListener
public javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name) throws java.lang.Exception
javax.management.MBeanRegistration
preRegister
in interface javax.management.MBeanRegistration
server
- The MBeanServer on which the MBean will be registered.name
- The ObjectName
of the MBean.ObjectName
of the registered MBean, must not be nulljava.lang.Exception
- Any possible exception generated by this method will be caught
by the MBeanServer
and re-thrown as an MBeanRegistrationException
to the client.public void postRegister(java.lang.Boolean registrationDone)
javax.management.MBeanRegistration
postRegister
in interface javax.management.MBeanRegistration
registrationDone
- True if the registration was successful, false otherwise.public void preDeregister() throws java.lang.Exception
javax.management.MBeanRegistration
preDeregister
in interface javax.management.MBeanRegistration
java.lang.Exception
- Any possible exception generated by this method will be caught
by the MBeanServer
and re-thrown as an MBeanRegistrationException
to the client.public void postDeregister()
javax.management.MBeanRegistration
postDeregister
in interface javax.management.MBeanRegistration
public void removeNotificationListener(javax.management.NotificationListener listener, javax.management.NotificationFilter filter, java.lang.Object handback) throws javax.management.ListenerNotFoundException
javax.management.NotificationEmitter
removeNotificationListener
in interface javax.management.NotificationEmitter
removeNotificationListener
in interface LoggerBroadcasterMBean
removeNotificationListener
in class javax.management.NotificationBroadcasterSupport
listener
- The listener that was previously added to this MBean.filter
- The filter that was specified when the listener was added.handback
- The handback that was specified when the listener was added.javax.management.ListenerNotFoundException
- If the triple listener, filter, handback is not registered with the emitterpublic void sendNotification(javax.management.Notification n)
javax.management.NotificationBroadcasterSupport
sendNotification
in class javax.management.NotificationBroadcasterSupport
n
- The notification to sendpublic void start()
start
in interface LoggerBroadcasterMBean
public void start(java.lang.String category)
start
in interface LoggerBroadcasterMBean
public void stop()
stop
in interface LoggerBroadcasterMBean
public void stop(java.lang.String category)
stop
in interface LoggerBroadcasterMBean
public javax.management.MBeanNotificationInfo[] getNotificationInfo()
javax.management.NotificationBroadcaster
getNotificationInfo
in interface javax.management.NotificationBroadcaster
getNotificationInfo
in class javax.management.NotificationBroadcasterSupport
protected Logger createLoggerPrototype()