/** * Constructor. * @param transportLogger The TransportLogger object which is to be managed by this MBean. * @param nextTransportName The name of the next TransportLayer. This is used to give a unique * name for each MBean of the TransportLoggerView class. * @param id The id of the TransportLogger to be watched. * @param managementContext The management context who has the MBeanServer where this MBean will be registered. */ public TransportLoggerView (TransportLogger transportLogger, String nextTransportName, int id, ManagementContext managementContext) { this.transportLogger = new WeakReference<TransportLogger>(transportLogger); this.nextTransportName = nextTransportName; this.id = id; this.managementContext = managementContext; this.name = this.createTransportLoggerObjectName(); TransportLoggerView.transportLoggerViews.add(this); this.register(); }
/** * Creates the ObjectName to be used when registering the MBean. * @return the ObjectName to be used when registering the MBean. */ private ObjectName createTransportLoggerObjectName() { try { return new ObjectName( createTransportLoggerObjectNameRoot(this.managementContext) + JMXSupport.encodeObjectNamePart(TransportLogger.class.getSimpleName() + " " + this.id + ";" + this.nextTransportName)); } catch (Exception e) { log.error("Could not create ObjectName for TransportLoggerView " + id + ", reason: " + e, e); return null; } }
public void disableAllTransportLoggers() { TransportLoggerView.disableAllTransportLoggers(); }
public void enableLogging() { this.setLogging(true); }
/** * Disable logging for all Transport Loggers at once. */ public static void disableAllTransportLoggers() { for (TransportLoggerView view : transportLoggerViews) { view.disableLogging(); } }
/** * Enable logging for all Transport Loggers at once. */ public static void enableAllTransportLoggers() { for (TransportLoggerView view : transportLoggerViews) { view.enableLogging(); } }
@Override public void stop() throws Exception { super.stop(); if (view != null) { view.unregister(); } } }
public void enableAllTransportLoggers() { TransportLoggerView.enableAllTransportLoggers(); }
TransportLoggerView tlv = new TransportLoggerView(tl, next.toString(), id, this.managementContext); tl.setView(tlv);
public void disableLogging() { this.setLogging(false); }
/** * Disable logging for all Transport Loggers at once. */ public static void disableAllTransportLoggers() { for (TransportLoggerView view : transportLoggerViews) { view.disableLogging(); } }
/** * Enable logging for all Transport Loggers at once. */ public static void enableAllTransportLoggers() { for (TransportLoggerView view : transportLoggerViews) { view.enableLogging(); } }
/** * We need to override this method * so that we can unregister the associated * MBean to avoid a memory leak. */ public void finalize() throws Throwable { if (view != null) { view.unregister(); } }
public void enableAllTransportLoggers() { TransportLoggerView.enableAllTransportLoggers(); }
TransportLoggerView tlv = new TransportLoggerView(tl, next.toString(), id, this.managementContext); tl.setView(tlv);
/** * Constructor. * @param transportLogger The TransportLogger object which is to be managed by this MBean. * @param nextTransportName The name of the next TransportLayer. This is used to give a unique * name for each MBean of the TransportLoggerView class. * @param id The id of the TransportLogger to be watched. * @param managementContext The management context who has the MBeanServer where this MBean will be registered. */ public TransportLoggerView (TransportLogger transportLogger, String nextTransportName, int id, ManagementContext managementContext) { this.transportLogger = new WeakReference<TransportLogger>(transportLogger); this.nextTransportName = nextTransportName; this.id = id; this.managementContext = managementContext; this.name = this.createTransportLoggerObjectName(); TransportLoggerView.transportLoggerViews.add(this); this.register(); }
public void disableLogging() { this.setLogging(false); }
/** * Disable logging for all Transport Loggers at once. */ public static void disableAllTransportLoggers() { for (TransportLoggerView view : transportLoggerViews) { view.disableLogging(); } }
/** * Enable logging for all Transport Loggers at once. */ public static void enableAllTransportLoggers() { for (TransportLoggerView view : transportLoggerViews) { view.enableLogging(); } }
@Override public void stop() throws Exception { super.stop(); if (view != null) { view.unregister(); } } }