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 String
createTransportLoggerObjectNameRoot(ManagementContext managementContext)
Creates the part of the ObjectName that will be used by all MBeans.static void
disableAllTransportLoggers()
Disable logging for all Transport Loggers at once.void
disableLogging()
Disables logging for the managed TransportLogger.static void
enableAllTransportLoggers()
Enable logging for all Transport Loggers at once.void
enableLogging()
Enables logging for the managed TransportLogger.boolean
isLogging()
Returns if the managed TransportLogger is currently active (writing to a log) or not.void
setLogging(boolean logging)
Enables or disables logging for the managed TransportLogger.void
unregister()
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:TransportLoggerViewMBean
Enables logging for the managed TransportLogger.- Specified by:
enableLogging
in interfaceTransportLoggerViewMBean
-
disableLogging
public void disableLogging()
Description copied from interface:TransportLoggerViewMBean
Disables logging for the managed TransportLogger.- Specified by:
disableLogging
in interfaceTransportLoggerViewMBean
-
isLogging
public boolean isLogging()
Description copied from interface:TransportLoggerViewMBean
Returns if the managed TransportLogger is currently active (writing to a log) or not.- Specified by:
isLogging
in 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:TransportLoggerViewMBean
Enables or disables logging for the managed TransportLogger.- Specified by:
setLogging
in 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.
-
-