You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by as...@apache.org on 2007/10/31 13:03:26 UTC

svn commit: r590634 - in /webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport: base/AbstractTransportListener.java jms/JMSListener.java vfs/VFSTransportListener.java

Author: asankha
Date: Wed Oct 31 05:03:25 2007
New Revision: 590634

URL: http://svn.apache.org/viewvc?rev=590634&view=rev
Log:
re-fix https://issues.apache.org/jira/browse/SYNAPSE-140

Modified:
    webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractTransportListener.java
    webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms/JMSListener.java
    webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java

Modified: webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractTransportListener.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractTransportListener.java?rev=590634&r1=590633&r2=590634&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractTransportListener.java (original)
+++ webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/base/AbstractTransportListener.java Wed Oct 31 05:03:25 2007
@@ -33,6 +33,7 @@
 import org.apache.axis2.engine.AxisEvent;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.axiom.om.util.UUIDGenerator;
 import org.apache.axiom.om.OMElement;
 
@@ -41,7 +42,7 @@
 public abstract class AbstractTransportListener implements TransportListener {
 
     /** the reference to the actual commons logger to be used for log messages */
-    protected static Log log = null;
+    protected Log log = null;
 
     /** the name of the transport */
     protected String transportName = null;
@@ -67,6 +68,13 @@
     protected boolean useAxis2ThreadPool = false;
 
     /**
+     * A constructor that makes subclasses pick up the correct logger
+     */
+    protected AbstractTransportListener() {
+        log = LogFactory.getLog(this.getClass());
+    }
+
+    /**
      * Initialize the generic transport. Sets up the transport and the thread pool to be used
      * for message processing. Also creates an AxisObserver that gets notified of service
      * life cycle events for the transport to act on
@@ -92,16 +100,6 @@
 
         // register to receive updates on services for lifetime management
         cfgCtx.getAxisConfiguration().addObservers(axisObserver);
-
-        // iterate through deployed services and start
-        Iterator services = cfgCtx.getAxisConfiguration().getServices().values().iterator();
-
-        while (services.hasNext()) {
-            AxisService service = (AxisService) services.next();
-            if (BaseUtils.isUsingTransport(service, transportName)) {
-                startListeningForService(service);
-            }
-        }
     }
 
     public void destroy() {
@@ -131,6 +129,16 @@
             started = true;
             // register to receive updates on services for lifetime management
             cfgCtx.getAxisConfiguration().addObservers(axisObserver);
+        }
+
+        // iterate through deployed services and start
+        Iterator services = cfgCtx.getAxisConfiguration().getServices().values().iterator();
+
+        while (services.hasNext()) {
+            AxisService service = (AxisService) services.next();
+            if (BaseUtils.isUsingTransport(service, transportName)) {
+                startListeningForService(service);
+            }
         }
     }
 

Modified: webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms/JMSListener.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms/JMSListener.java?rev=590634&r1=590633&r2=590634&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms/JMSListener.java (original)
+++ webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/jms/JMSListener.java Wed Oct 31 05:03:25 2007
@@ -59,11 +59,6 @@
     /** A Map of service name to the JMS EPR addresses */
     private Map serviceNameToEPRMap = new HashMap();
 
-    // setup the logging for the transport
-    static {
-        log = LogFactory.getLog(JMSListener.class);
-    }
-
     /**
      * This is the TransportListener initialization method invoked by Axis2
      *
@@ -73,7 +68,7 @@
     public void init(ConfigurationContext cfgCtx,
                      TransportInDescription trpInDesc) throws AxisFault {
         setTransportName(TRANSPORT_NAME);
-        super.init(cfgCtx, trpInDesc);        
+        super.init(cfgCtx, trpInDesc);
 
         // read the connection factory definitions and create them
         loadConnectionFactoryDefinitions(trpInDesc);
@@ -84,20 +79,6 @@
             return;
         }
 
-        // iterate through deployed services and validate connection factory
-        // names, and mark services as faulty where appropriate
-        Iterator services = cfgCtx.getAxisConfiguration().getServices().values().iterator();
-
-        // start connection factories
-        start();
-
-        while (services.hasNext()) {
-            AxisService service = (AxisService) services.next();
-            if (BaseUtils.isUsingTransport(service, transportName)) {
-                startListeningForService(service);
-            }
-        }
-
         log.info("JMS Transport Receiver/Listener initialized...");
     }
 
@@ -122,6 +103,8 @@
                 handleException("Error starting connection factory : " + conFac.getName(), e);
             }
         }
+
+        super.start();
     }
 
     /**

Modified: webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java?rev=590634&r1=590633&r2=590634&view=diff
==============================================================================
--- webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java (original)
+++ webservices/synapse/trunk/java/modules/transports/src/main/java/org/apache/synapse/transport/vfs/VFSTransportListener.java Wed Oct 31 05:03:25 2007
@@ -99,10 +99,6 @@
     /** The VFS file system manager */
     private FileSystemManager fsManager = null;
 
-    static {
-        log = LogFactory.getLog(VFSTransportListener.class);
-    }
-
     /**
      * Initializes the VFS transport by getting the VFS File System manager
      * @param cfgCtx the Axsi2 configuration context



---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org