activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r384222 - in /incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http: BlockingQueueTransport.java HttpClientTransport.java HttpTransport.java HttpTransportServer.java
Date Wed, 08 Mar 2006 14:30:49 GMT
Author: jstrachan
Date: Wed Mar  8 06:30:48 2006
New Revision: 384222

URL: http://svn.apache.org/viewcvs?rev=384222&view=rev
Log:
Refactorings of the transport/service base classes

Modified:
    incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/BlockingQueueTransport.java
    incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpClientTransport.java
    incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java
    incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java

Modified: incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/BlockingQueueTransport.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/BlockingQueueTransport.java?rev=384222&r1=384221&r2=384222&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/BlockingQueueTransport.java
(original)
+++ incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/BlockingQueueTransport.java
Wed Mar  8 06:30:48 2006
@@ -21,6 +21,7 @@
 
 import org.apache.activemq.command.Command;
 import org.apache.activemq.transport.TransportSupport;
+import org.apache.activemq.util.ServiceStopper;
 
 import javax.jms.JMSException;
 
@@ -44,13 +45,13 @@
         return queue;
     }
 
-    public void start() throws JMSException {
-    }
-
     public void oneway(Command command) throws IOException {
         queue.add(command);
     }
 
-    public void stop() throws Exception {
+    protected void doStart() throws Exception {
     }
+
+    protected void doStop(ServiceStopper stopper) throws Exception {
+    }   
 }

Modified: incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpClientTransport.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpClientTransport.java?rev=384222&r1=384221&r2=384222&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpClientTransport.java
(original)
+++ incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpClientTransport.java
Wed Mar  8 06:30:48 2006
@@ -94,7 +94,7 @@
         log.trace("HTTP GET consumer thread starting: " + this);
         HttpClient httpClient = getReceiveHttpClient();
         URI remoteUrl = getRemoteUrl();
-        while (!isClosed()) {
+        while (!isStopped()) {
 
             GetMethod httpMethod = new GetMethod(remoteUrl.toString());
             configureMethod(httpMethod);

Modified: incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java?rev=384222&r1=384221&r2=384222&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java
(original)
+++ incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java
Wed Mar  8 06:30:48 2006
@@ -75,7 +75,7 @@
     public void run() {
         log.trace("HTTP GET consumer thread starting for transport: " + this);
         URI remoteUrl = getRemoteUrl();
-        while (!isClosed()) {
+        while (!isStopped()) {
             try {
                 HttpURLConnection connection = getReceiveConnection();
                 int answer = connection.getResponseCode();
@@ -100,7 +100,7 @@
                 }
             }
             catch (Exception e) {
-                if (!isClosed()) {
+                if (!isStopped()) {
                     log.warn("Failed to perform GET on: " + remoteUrl + " due to: " + e,
e);
                 }
                 else {

Modified: incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java?rev=384222&r1=384221&r2=384222&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java
(original)
+++ incubator/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java
Wed Mar  8 06:30:48 2006
@@ -20,6 +20,7 @@
 import org.apache.activemq.transport.TransportServerSupport;
 import org.apache.activemq.transport.util.TextWireFormat;
 import org.apache.activemq.transport.xstream.XStreamWireFormat;
+import org.apache.activemq.util.ServiceStopper;
 import org.mortbay.jetty.Connector;
 import org.mortbay.jetty.Server;
 import org.mortbay.jetty.bio.SocketConnector;
@@ -46,7 +47,33 @@
         this.bindAddress = uri;
     }
 
-    public void start() throws Exception {
+    public void setBrokerInfo(BrokerInfo brokerInfo) {
+    }
+
+    // Properties
+    // -------------------------------------------------------------------------
+    public TextWireFormat getWireFormat() {
+        if (wireFormat == null) {
+            wireFormat = createWireFormat();
+        }
+        return wireFormat;
+    }
+
+    public void setWireFormat(TextWireFormat wireFormat) {
+        this.wireFormat = wireFormat;
+    }
+
+    // Implementation methods
+    // -------------------------------------------------------------------------
+    protected TextWireFormat createWireFormat() {
+        return new XStreamWireFormat();
+    }
+
+    protected void setConnector(Connector connector) {
+        this.connector = connector;
+    }
+    
+    protected void doStart() throws Exception {
         server = new Server();
         if (connector==null)
             connector = new SocketConnector();
@@ -81,7 +108,7 @@
         server.start();
     }
 
-    public synchronized void stop() throws Exception {
+    protected void doStop(ServiceStopper stopper) throws Exception {
         Server temp = server;
         server = null;
         if (temp != null) {
@@ -89,29 +116,4 @@
         }
     }
 
-    // Properties
-    // -------------------------------------------------------------------------
-    public TextWireFormat getWireFormat() {
-        if (wireFormat == null) {
-            wireFormat = createWireFormat();
-        }
-        return wireFormat;
-    }
-
-    public void setWireFormat(TextWireFormat wireFormat) {
-        this.wireFormat = wireFormat;
-    }
-
-    // Implementation methods
-    // -------------------------------------------------------------------------
-    protected TextWireFormat createWireFormat() {
-        return new XStreamWireFormat();
-    }
-
-    protected void setConnector(Connector connector) {
-        this.connector = connector;
-    }
-
-    public void setBrokerInfo(BrokerInfo brokerInfo) {
-    }
 }



Mime
View raw message