activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r580273 - in /activemq/trunk: activemq-core/src/main/java/org/apache/activemq/transport/ activemq-core/src/main/java/org/apache/activemq/transport/logwriters/ activemq-core/src/main/java/org/apache/activemq/transport/tcp/ activemq-core/src/...
Date Fri, 28 Sep 2007 09:46:51 GMT
Author: rajdavies
Date: Fri Sep 28 02:46:50 2007
New Revision: 580273

URL: http://svn.apache.org/viewvc?rev=580273&view=rev
Log:

Rolled back patches  for https://issues.apache.org/activemq/browse/AMQ-1361 - as no licence
headers where provided - we can't accept

Removed:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/LogWriter.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportLoggerControl.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportLoggerControlMBean.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportLoggerFactory.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportLoggerView.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportLoggerViewMBean.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/logwriters/
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/util/LogWriterFinder.java
    activemq/trunk/activemq-core/src/main/resources/META-INF/services/org/apache/activemq/transport/logwriters/
    activemq/trunk/log_analyzer_tool/
Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportLogger.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportLogger.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportLogger.java?rev=580273&r1=580272&r2=580273&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportLogger.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportLogger.java
Fri Sep 28 02:46:50 2007
@@ -19,136 +19,71 @@
 import java.io.IOException;
 
 import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * @version $Revision$
  */
 public class TransportLogger extends TransportFilter {
 
+    private static int lastId;
     private final Log log;
-    private boolean logging;
-    private final LogWriter logWriter;
-    private TransportLoggerView view;
-
-    public TransportLogger(Transport next, Log log, boolean startLogging, LogWriter logWriter)
{
-        // Changed constructor to pass the implementation of the LogWriter interface
-        // that will be used to write the messages.
+
+    public TransportLogger(Transport next) {
+        this(next, LogFactory.getLog(TransportLogger.class.getName() + ".Connection:" + getNextId()));
+    }
+
+    public TransportLogger(Transport next, Log log) {
         super(next);
         this.log = log;
-        this.logging = startLogging;
-        this.logWriter = logWriter;
     }
 
-    /**
-     * Returns true if logging is activated for this TransportLogger, false otherwise.
-     * @return true if logging is activated for this TransportLogger, false otherwise.
-     */
-    public boolean isLogging() {
-        return logging;
-    }
-
-    /**
-     * Sets if logging should be activated for this TransportLogger.
-     * @param logging true to activate logging, false to deactivate.
-     */
-    public void setLogging(boolean logging) {
-        this.logging = logging;
-    }  
+    private static synchronized int getNextId() {
+        return ++lastId;
+    }
 
     public Object request(Object command) throws IOException {
-        // Changed this method to use a LogWriter object to actually 
-        // print the messages to the log, and only in case of logging 
-        // being active, instead of logging the message directly.
-        if (logging)
-            logWriter.logRequest(log, command);
-    	Object rc = super.request(command);
-        if (logging)
-            logWriter.logResponse(log, command);
-    	return rc;
+        log.debug("SENDING REQUEST: " + command);
+        Object rc = super.request(command);
+        log.debug("GOT RESPONSE: " + rc);
+        return rc;
     }
 
     public Object request(Object command, int timeout) throws IOException {
-        // Changed this method to use a LogWriter object to actually 
-        // print the messages to the log, and only in case of logging 
-        // being active, instead of logging the message directly.
-        if (logging)
-            logWriter.logRequest(log, command);
+        log.debug("SENDING REQUEST: " + command);
         Object rc = super.request(command, timeout);
-        if (logging)
-            logWriter.logResponse(log, command);
-    	return rc;
+        log.debug("GOT RESPONSE: " + rc);
+        return rc;
     }
 
     public FutureResponse asyncRequest(Object command, ResponseCallback responseCallback)
throws IOException {
-        // Changed this method to use a LogWriter object to actually 
-        // print the messages to the log, and only in case of logging 
-        // being active, instead of logging the message directly.
-        if (logging)
-            logWriter.logAsyncRequest(log, command);
-    	FutureResponse rc = next.asyncRequest(command, responseCallback);
-    	return rc;
+        log.debug("SENDING ASNYC REQUEST: " + command);
+        FutureResponse rc = next.asyncRequest(command, responseCallback);
+        return rc;
     }
 
     public void oneway(Object command) throws IOException {
-        // Changed this method to use a LogWriter object to actually 
-        // print the messages to the log, and only in case of logging 
-        // being active, instead of logging the message directly.
-        if( logging && log.isDebugEnabled() ) {
-            logWriter.logOneWay(log, command);
+        if (log.isDebugEnabled()) {
+            log.debug("SENDING: " + command);
         }
         next.oneway(command);
     }
 
     public void onCommand(Object command) {
-        // Changed this method to use a LogWriter object to actually 
-        // print the messages to the log, and only in case of logging 
-        // being active, instead of logging the message directly.
-        if( logging && log.isDebugEnabled() ) {
-            logWriter.logReceivedCommand(log, command);
+        if (log.isDebugEnabled()) {
+            log.debug("RECEIVED: " + command);
         }
         getTransportListener().onCommand(command);
     }
 
     public void onException(IOException error) {
-        // Changed this method to use a LogWriter object to actually 
-        // print the messages to the log, and only in case of logging 
-        // being active, instead of logging the message directly.
-        if( logging && log.isDebugEnabled() ) {
-            logWriter.logReceivedException(log, error);
+        if (log.isDebugEnabled()) {
+            log.debug("RECEIVED Exception: " + error, error);
         }
         getTransportListener().onException(error);
     }
 
-    /**
-     * Gets the associated MBean for this TransportLogger.
-     * @return the associated MBean for this TransportLogger.
-     */
-    public TransportLoggerView getView() {
-        return view;
-    }
-
-    /**
-     * Sets the associated MBean for this TransportLogger.
-     * @param view the associated MBean for this TransportLogger.
-     */
-    public void setView(TransportLoggerView view) {
-        this.view = view;
-    }
-    
     public String toString() {
         return next.toString();
     }
-    
-    /**
-     * 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();    
-        }
-    }
-
-
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java?rev=580273&r1=580272&r2=580273&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/SslTransportFactory.java
Fri Sep 28 02:46:50 2007
@@ -38,7 +38,6 @@
 import org.apache.activemq.transport.InactivityMonitor;
 import org.apache.activemq.transport.Transport;
 import org.apache.activemq.transport.TransportLogger;
-import org.apache.activemq.transport.TransportLoggerFactory;
 import org.apache.activemq.transport.TransportServer;
 import org.apache.activemq.transport.WireFormatNegotiator;
 import org.apache.activemq.util.IOExceptionSupport;
@@ -105,12 +104,7 @@
         sslTransport.setSocketOptions(socketOptions);
 
         if (sslTransport.isTrace()) {
-            try {
-                transport = TransportLoggerFactory.getInstance().createTransportLogger(transport,
-                        sslTransport.getLogWriterName(), sslTransport.isDynamicManagement(),
sslTransport.isStartLogging(), sslTransport.getJmxPort());
-            } catch (Throwable e) {
-                LOG.error("Could not create TransportLogger object for: " + sslTransport.getLogWriterName()
+ ", reason: " + e, e);
-            }
+            transport = new TransportLogger(transport);
         }
 
         transport = new InactivityMonitor(transport);

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java?rev=580273&r1=580272&r2=580273&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
Fri Sep 28 02:46:50 2007
@@ -36,7 +36,6 @@
 
 import org.apache.activemq.Service;
 import org.apache.activemq.transport.Transport;
-import org.apache.activemq.transport.TransportLoggerFactory;
 import org.apache.activemq.transport.TransportThreadSupport;
 import org.apache.activemq.util.IntrospectionSupport;
 import org.apache.activemq.util.ServiceStopper;
@@ -72,12 +71,7 @@
      * This parameter is most probably set in Connection or TransportConnector URIs.
      */
     protected boolean trace = false;
-    /**
-     * Name of the LogWriter implementation to use.
-     * Names are mapped to classes in the resources/META-INF/services/org/apache/activemq/transport/logwriters
directory.
-     * This parameter is most probably set in Connection or TransportConnector URIs.
-     */
-    protected String logWriterName = TransportLoggerFactory.defaultLogWriterName;
+    
     /**
      * Specifies if the TransportLogger will be manageable by JMX or not.
      * Also, as long as there is at least 1 TransportLogger which is manageable,
@@ -206,16 +200,6 @@
     public void setTrace(boolean trace) {
         this.trace = trace;
     }
-
-    public String getLogWriterName() {
-        return logWriterName;
-    }
-
-
-    public void setLogWriterName(String logFormat) {
-        this.logWriterName = logFormat;
-    }
-
 
     public boolean isDynamicManagement() {
         return dynamicManagement;

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java?rev=580273&r1=580272&r2=580273&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java
Fri Sep 28 02:46:50 2007
@@ -30,7 +30,7 @@
 import org.apache.activemq.transport.InactivityMonitor;
 import org.apache.activemq.transport.Transport;
 import org.apache.activemq.transport.TransportFactory;
-import org.apache.activemq.transport.TransportLoggerFactory;
+import org.apache.activemq.transport.TransportLogger;
 import org.apache.activemq.transport.TransportServer;
 import org.apache.activemq.transport.WireFormatNegotiator;
 import org.apache.activemq.util.IOExceptionSupport;
@@ -84,12 +84,7 @@
         tcpTransport.setSocketOptions(socketOptions);
         
         if (tcpTransport.isTrace()) {
-            try {
-                transport = TransportLoggerFactory.getInstance().createTransportLogger(transport,
tcpTransport.getLogWriterName(),
-                        tcpTransport.isDynamicManagement(), tcpTransport.isStartLogging(),
tcpTransport.getJmxPort());
-            } catch (Throwable e) {
-                LOG.error("Could not create TransportLogger object for: " + tcpTransport.getLogWriterName()
+ ", reason: " + e, e);
-            }
+            transport = new TransportLogger(transport);
         }
 
         if (isUseInactivityMonitor(transport)) {

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java?rev=580273&r1=580272&r2=580273&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
Fri Sep 28 02:46:50 2007
@@ -33,7 +33,6 @@
 import org.apache.activemq.command.BrokerInfo;
 import org.apache.activemq.openwire.OpenWireFormatFactory;
 import org.apache.activemq.transport.Transport;
-import org.apache.activemq.transport.TransportLoggerFactory;
 import org.apache.activemq.transport.TransportServer;
 import org.apache.activemq.transport.TransportServerThreadSupport;
 import org.apache.activemq.util.IOExceptionSupport;
@@ -68,12 +67,6 @@
      */
     protected boolean trace = false;
     /**
-     * Name of the LogWriter implementation to use.
-     * Names are mapped to classes in the resources/META-INF/services/org/apache/activemq/transport/logwriters
directory.
-     * This parameter is most probably set in Connection or TransportConnector URIs.
-     */
-    protected String logWriterName = TransportLoggerFactory.defaultLogWriterName;
-    /**
      * Specifies if the TransportLogger will be manageable by JMX or not.
      * Also, as long as there is at least 1 TransportLogger which is manageable,
      * a TransportLoggerControl MBean will me created.
@@ -177,15 +170,6 @@
         this.trace = trace;
     }
 
-    public String getLogWriterName() {
-        return logWriterName;
-    }
-
-
-    public void setLogWriterName(String logFormat) {
-        this.logWriterName = logFormat;
-    }
-
     public boolean isDynamicManagement() {
         return dynamicManagement;
     }
@@ -219,7 +203,6 @@
                         options.put("maxInactivityDuration", Long.valueOf(maxInactivityDuration));
                         options.put("minmumWireFormatVersion", Integer.valueOf(minmumWireFormatVersion));
                         options.put("trace", Boolean.valueOf(trace));
-                        options.put("logWriterName", logWriterName);
                         options.put("dynamicManagement", Boolean.valueOf(dynamicManagement));
                         options.put("startLogging", Boolean.valueOf(startLogging));
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java?rev=580273&r1=580272&r2=580273&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportFactory.java
Fri Sep 28 02:46:50 2007
@@ -28,7 +28,7 @@
 import org.apache.activemq.transport.InactivityMonitor;
 import org.apache.activemq.transport.Transport;
 import org.apache.activemq.transport.TransportFactory;
-import org.apache.activemq.transport.TransportLoggerFactory;
+import org.apache.activemq.transport.TransportLogger;
 import org.apache.activemq.transport.TransportServer;
 import org.apache.activemq.transport.reliable.DefaultReplayStrategy;
 import org.apache.activemq.transport.reliable.ExceptionIfDroppedReplayStrategy;
@@ -78,11 +78,7 @@
         transport = new CommandJoiner(transport, asOpenWireFormat(format));
 
         if (udpTransport.isTrace()) {
-            try {
-                transport = TransportLoggerFactory.getInstance().createTransportLogger(transport);
-            } catch (Throwable e) {
-                log.error("Could not create TransportLogger object for: " + TransportLoggerFactory.defaultLogWriterName
+ ", reason: " + e, e);
-            }
+            transport = new TransportLogger(transport);
         }
 
         transport = new InactivityMonitor(transport);
@@ -114,7 +110,7 @@
         OpenWireFormat openWireFormat = asOpenWireFormat(format);
 
         if (udpTransport.isTrace()) {
-            transport = TransportLoggerFactory.getInstance().createTransportLogger(transport);
+            transport = new TransportLogger(transport);
         }
 
         transport = new InactivityMonitor(transport);



Mime
View raw message