activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r388202 - in /incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport: ./ activeio/ tcp/ udp/ vm/
Date Thu, 23 Mar 2006 16:37:47 GMT
Author: chirino
Date: Thu Mar 23 08:37:45 2006
New Revision: 388202

URL: http://svn.apache.org/viewcvs?rev=388202&view=rev
Log:
Added a way to get the socket address that a transport server is accepting connection on.
 Needed by gbean modules.

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportServer.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportServerFilter.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/activeio/ActiveIOTransportServer.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportServer.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportServer.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportServer.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportServer.java?rev=388202&r1=388201&r2=388202&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportServer.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportServer.java
Thu Mar 23 08:37:45 2006
@@ -16,6 +16,7 @@
  */
 package org.apache.activemq.transport;
 
+import java.net.InetSocketAddress;
 import java.net.URI;
 
 import org.apache.activemq.Service;
@@ -35,7 +36,7 @@
 	 *  
 	 * @param acceptListener
 	 */
-    void setAcceptListener(TransportAcceptListener acceptListener);
+    public void setAcceptListener(TransportAcceptListener acceptListener);
     
     /**
      * Associates a broker info with the transport server so that the transport can do
@@ -43,8 +44,15 @@
      * 
      * @param brokerInfo
      */
-    void setBrokerInfo(BrokerInfo brokerInfo);
+    public void setBrokerInfo(BrokerInfo brokerInfo);
 
     public URI getConnectURI();
+
+    
+    /**
+     * @return The socket address that this transport is accepting connections on or null
if 
+     * this does not or is not currently accepting connections on a socket.
+     */
+    public InetSocketAddress getSocketAddress();
     
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportServerFilter.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportServerFilter.java?rev=388202&r1=388201&r2=388202&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportServerFilter.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportServerFilter.java
Thu Mar 23 08:37:45 2006
@@ -16,6 +16,7 @@
  */
 package org.apache.activemq.transport;
 
+import java.net.InetSocketAddress;
 import java.net.URI;
 
 import org.apache.activemq.command.BrokerInfo;
@@ -49,6 +50,10 @@
 
     public void stop() throws Exception {
         next.stop();
+    }
+
+    public InetSocketAddress getSocketAddress() {
+        return next.getSocketAddress();
     }
     
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/activeio/ActiveIOTransportServer.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/activeio/ActiveIOTransportServer.java?rev=388202&r1=388201&r2=388202&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/activeio/ActiveIOTransportServer.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/activeio/ActiveIOTransportServer.java
Thu Mar 23 08:37:45 2006
@@ -17,6 +17,7 @@
 package org.apache.activemq.transport.activeio;
 
 import java.io.IOException;
+import java.net.InetSocketAddress;
 import java.net.URI;
 import java.util.Map;
 
@@ -111,6 +112,11 @@
 
     public void setStopTimeout(long stopTimeout) {
         this.stopTimeout = stopTimeout;
+    }
+
+    public InetSocketAddress getSocketAddress() {
+        // TODO: need to drill into the server object to get the socket address
+        return null;
     }
     
     

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java?rev=388202&r1=388201&r2=388202&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransportServer.java
Thu Mar 23 08:37:45 2006
@@ -28,6 +28,7 @@
 
 import java.io.IOException;
 import java.net.InetAddress;
+import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.SocketTimeoutException;
@@ -211,5 +212,9 @@
         if (serverSocket != null) {
             serverSocket.close();
         }
+    }
+
+    public InetSocketAddress getSocketAddress() {
+        return (InetSocketAddress)serverSocket.getLocalSocketAddress();
     }
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java?rev=388202&r1=388201&r2=388202&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java
Thu Mar 23 08:37:45 2006
@@ -431,4 +431,12 @@
     protected void setChannel(DatagramChannel channel) {
         this.channel = channel;
     }
+
+    public InetSocketAddress getLocalSocketAddress() {
+        if( channel==null ) {
+            return null;
+        } else {
+            return (InetSocketAddress)channel.socket().getLocalSocketAddress();
+        }
+    }
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportServer.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportServer.java?rev=388202&r1=388201&r2=388202&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportServer.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransportServer.java
Thu Mar 23 08:37:45 2006
@@ -33,6 +33,7 @@
 import org.apache.commons.logging.LogFactory;
 
 import java.io.IOException;
+import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.net.URI;
 import java.util.HashMap;
@@ -179,5 +180,9 @@
         };
         return wireFormatNegotiator;
         */
+    }
+    
+    public InetSocketAddress getSocketAddress() {
+        return serverTransport.getLocalSocketAddress();
     }
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportServer.java
URL: http://svn.apache.org/viewcvs/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportServer.java?rev=388202&r1=388201&r2=388202&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportServer.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransportServer.java
Thu Mar 23 08:37:45 2006
@@ -17,6 +17,7 @@
 package org.apache.activemq.transport.vm;
 
 import java.io.IOException;
+import java.net.InetSocketAddress;
 import java.net.URI;
 
 import org.apache.activemq.command.BrokerInfo;
@@ -127,5 +128,9 @@
     }
 
     public void setBrokerInfo(BrokerInfo brokerInfo) {
+    }
+
+    public InetSocketAddress getSocketAddress() {
+        return null;
     }
 }



Mime
View raw message