org.apache.activemq.transport
Class TransportLogger

java.lang.Object
  extended by org.apache.activemq.transport.TransportFilter
      extended by org.apache.activemq.transport.TransportLogger
All Implemented Interfaces:
Service, Transport, TransportListener

public class TransportLogger
extends TransportFilter

This TransportFilter implementation writes output to a log as it intercepts commands / events before sending them to the following layer in the Transport stack.

Author:
David Martin Clavo david(dot)martin(dot)clavo(at)gmail.com

Field Summary
 
Fields inherited from class org.apache.activemq.transport.TransportFilter
next, transportListener
 
Constructor Summary
TransportLogger(Transport next, org.slf4j.Logger log, boolean startLogging, LogWriter logWriter)
           
 
Method Summary
 FutureResponse asyncRequest(Object command, ResponseCallback responseCallback)
           
 void finalize()
          We need to override this method so that we can unregister the associated MBean to avoid a memory leak.
 TransportLoggerView getView()
          Gets the associated MBean for this TransportLogger.
 boolean isLogging()
          Returns true if logging is activated for this TransportLogger, false otherwise.
 void onCommand(Object command)
           
 void oneway(Object command)
           
 void onException(IOException error)
           
 Object request(Object command)
           
 Object request(Object command, int timeout)
           
 void setLogging(boolean logging)
          Sets if logging should be activated for this TransportLogger.
 void setView(TransportLoggerView view)
          Sets the associated MBean for this TransportLogger.
 String toString()
           
 
Methods inherited from class org.apache.activemq.transport.TransportFilter
getNext, getReceiveCounter, getRemoteAddress, getTransportListener, isConnected, isDisposed, isFaultTolerant, isReconnectSupported, isUpdateURIsSupported, narrow, reconnect, setTransportListener, start, stop, transportInterupted, transportResumed, updateURIs
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TransportLogger

public TransportLogger(Transport next,
                       org.slf4j.Logger log,
                       boolean startLogging,
                       LogWriter logWriter)
Method Detail

isLogging

public boolean isLogging()
Returns true if logging is activated for this TransportLogger, false otherwise.

Returns:
true if logging is activated for this TransportLogger, false otherwise.

setLogging

public void setLogging(boolean logging)
Sets if logging should be activated for this TransportLogger.

Parameters:
logging - true to activate logging, false to deactivate.

request

public Object request(Object command)
               throws IOException
Specified by:
request in interface Transport
Overrides:
request in class TransportFilter
Throws:
IOException

request

public Object request(Object command,
                      int timeout)
               throws IOException
Specified by:
request in interface Transport
Overrides:
request in class TransportFilter
Throws:
IOException

asyncRequest

public FutureResponse asyncRequest(Object command,
                                   ResponseCallback responseCallback)
                            throws IOException
Specified by:
asyncRequest in interface Transport
Overrides:
asyncRequest in class TransportFilter
Throws:
IOException

oneway

public void oneway(Object command)
            throws IOException
Specified by:
oneway in interface Transport
Overrides:
oneway in class TransportFilter
Throws:
IOException

onCommand

public void onCommand(Object command)
Specified by:
onCommand in interface TransportListener
Overrides:
onCommand in class TransportFilter

onException

public void onException(IOException error)
Specified by:
onException in interface TransportListener
Overrides:
onException in class TransportFilter

getView

public TransportLoggerView getView()
Gets the associated MBean for this TransportLogger.

Returns:
the associated MBean for this TransportLogger.

setView

public void setView(TransportLoggerView view)
Sets the associated MBean for this TransportLogger.

Parameters:
view - the associated MBean for this TransportLogger.

toString

public String toString()
Overrides:
toString in class TransportFilter

finalize

public void finalize()
              throws Throwable
We need to override this method so that we can unregister the associated MBean to avoid a memory leak.

Overrides:
finalize in class Object
Throws:
Throwable


Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.