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:
  • 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: TransportLoggerViewMBean
      Enables logging for the managed TransportLogger.
      Specified by:
      enableLogging in interface TransportLoggerViewMBean
    • disableLogging

      public void disableLogging()
      Description copied from interface: TransportLoggerViewMBean
      Disables logging for the managed TransportLogger.
      Specified by:
      disableLogging in interface TransportLoggerViewMBean
    • 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 interface TransportLoggerViewMBean
      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 interface TransportLoggerViewMBean
      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.