Package org.apache.activemq.transport
Class TransportLoggerView
- java.lang.Object
-
- org.apache.activemq.transport.TransportLoggerView
-
- All Implemented Interfaces:
TransportLoggerViewMBean
public class TransportLoggerView extends Object implements 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:
TransportLoggerViewMBean
-
-
Constructor Summary
Constructors Constructor Description TransportLoggerView(TransportLogger transportLogger, String nextTransportName, int id, ManagementContext managementContext)Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static StringcreateTransportLoggerObjectNameRoot(ManagementContext managementContext)Creates the part of the ObjectName that will be used by all MBeans.static voiddisableAllTransportLoggers()Disable logging for all Transport Loggers at once.voiddisableLogging()Disables logging for the managed TransportLogger.static voidenableAllTransportLoggers()Enable logging for all Transport Loggers at once.voidenableLogging()Enables logging for the managed TransportLogger.booleanisLogging()Returns if the managed TransportLogger is currently active (writing to a log) or not.voidsetLogging(boolean logging)Enables or disables logging for the managed TransportLogger.voidunregister()Unregisters the MBean from the MBeanServer of the management context provided at creation time.
-
-
-
Constructor Detail
-
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 Detail
-
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
public static String createTransportLoggerObjectNameRoot(ManagementContext managementContext)
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.
-
-