Package org.apache.activemq.transport
Class TransportLoggerView
java.lang.Object
org.apache.activemq.transport.TransportLoggerView
- All Implemented Interfaces:
TransportLoggerViewMBean
Class implementing the TransportLoggerViewMBean interface.
When an object of this class is created, it registers itself in
the MBeanServer of the management context provided.
When a TransportLogger object is finalized because the Transport Stack
where it resides is no longer in use, the method unregister() will be called.
- Author:
- David Martin Clavo david(dot)martin(dot)clavo(at)gmail.com
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTransportLoggerView(TransportLogger transportLogger, String nextTransportName, int id, ManagementContext managementContext) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcreateTransportLoggerObjectNameRoot(ManagementContext managementContext) Creates the part of the ObjectName that will be used by all MBeans.static voidDisable logging for all Transport Loggers at once.voidDisables logging for the managed TransportLogger.static voidEnable logging for all Transport Loggers at once.voidEnables logging for the managed TransportLogger.booleanReturns if the managed TransportLogger is currently active (writing to a log) or not.voidsetLogging(boolean logging) Enables or disables logging for the managed TransportLogger.voidUnregisters the MBean from the MBeanServer of the management context provided at creation time.
-
Constructor Details
-
TransportLoggerView
public TransportLoggerView(TransportLogger transportLogger, String nextTransportName, int id, ManagementContext managementContext) Constructor.- Parameters:
transportLogger- The TransportLogger object which is to be managed by this MBean.nextTransportName- The name of the next TransportLayer. This is used to give a unique name for each MBean of the TransportLoggerView class.id- The id of the TransportLogger to be watched.managementContext- The management context who has the MBeanServer where this MBean will be registered.
-
-
Method Details
-
enableAllTransportLoggers
public static void enableAllTransportLoggers()Enable logging for all Transport Loggers at once. -
disableAllTransportLoggers
public static void disableAllTransportLoggers()Disable logging for all Transport Loggers at once. -
enableLogging
public void enableLogging()Description copied from interface:TransportLoggerViewMBeanEnables logging for the managed TransportLogger.- Specified by:
enableLoggingin interfaceTransportLoggerViewMBean
-
disableLogging
public void disableLogging()Description copied from interface:TransportLoggerViewMBeanDisables logging for the managed TransportLogger.- Specified by:
disableLoggingin interfaceTransportLoggerViewMBean
-
isLogging
public boolean isLogging()Description copied from interface:TransportLoggerViewMBeanReturns if the managed TransportLogger is currently active (writing to a log) or not.- Specified by:
isLoggingin interfaceTransportLoggerViewMBean- Returns:
- if the managed TransportLogger is currently active (writing to a log) or not.
-
setLogging
public void setLogging(boolean logging) Description copied from interface:TransportLoggerViewMBeanEnables or disables logging for the managed TransportLogger.- Specified by:
setLoggingin interfaceTransportLoggerViewMBean- Parameters:
logging- Boolean value to enable or disable logging for the managed TransportLogger. true to enable logging, false to disable logging.
-
unregister
public void unregister()Unregisters the MBean from the MBeanServer of the management context provided at creation time. This method is called by the TransportLogger object being managed when the TransportLogger object is finalized, to avoid the memory leak that would be caused if MBeans were not unregistered. -
createTransportLoggerObjectNameRoot
Creates the part of the ObjectName that will be used by all MBeans. This method is public so it can be used by the TransportLoggerControl class.- Parameters:
managementContext-- Returns:
- A String with the part of the ObjectName common to all the TransportLoggerView MBeans.
-