activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject svn commit: r415306 - in /incubator/activemq/trunk/activemq-core/src: main/java/org/apache/activemq/broker/ main/java/org/apache/activemq/broker/jmx/ main/java/org/apache/activemq/transport/ main/java/org/apache/activemq/transport/activeio/ main/java/o...
Date Mon, 19 Jun 2006 12:33:00 GMT
Author: jstrachan
Date: Mon Jun 19 05:32:59 2006
New Revision: 415306

URL: http://svn.apache.org/viewvc?rev=415306&view=rev
Log:
applied patch from Jason Sherman for AMQ-753 to expose the remote connection address in JMX
- many thanks!

Modified:
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/Connection.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectionView.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/Transport.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportFilter.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/activeio/ActiveIOTransport.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransport.java
    incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.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/vm/VMTransport.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/StubTransport.java
    incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompSubscriptionRemoveTest.java

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/Connection.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/Connection.java?rev=415306&r1=415305&r2=415306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/Connection.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/Connection.java
Mon Jun 19 05:32:59 2006
@@ -96,4 +96,9 @@
      */
     public boolean isManageable();
 
+    /**
+     * @return the source address for this connection
+     */
+	public String getRemoteAddress();
+
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java?rev=415306&r1=415305&r2=415306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/TransportConnection.java
Mon Jun 19 05:32:59 2006
@@ -216,4 +216,8 @@
             setMarkedCandidate(false);
         }
     }
+
+	public String getRemoteAddress() {
+		return transport.getRemoteAddress();
+	}
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectionView.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectionView.java?rev=415306&r1=415305&r2=415306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectionView.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectionView.java
Mon Jun 19 05:32:59 2006
@@ -97,4 +97,8 @@
         return connection.getStatistics().getDequeues().getCount();
     }
 
+	public String getRemoteAddress() {
+		return connection.getRemoteAddress();
+	}
+
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java?rev=415306&r1=415305&r2=415306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/broker/jmx/ConnectionViewMBean.java
Mon Jun 19 05:32:59 2006
@@ -62,5 +62,12 @@
      * @return the number of messages dequeued on this connection
      */
     public long getDequeueCount();
+    
+    /**
+     * Returns the source address for this connection
+     * 
+     * @return the souce address for this connection
+     */
+    public String getRemoteAddress();
 
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/Transport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/Transport.java?rev=415306&r1=415305&r2=415306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/Transport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/Transport.java
Mon Jun 19 05:32:59 2006
@@ -84,4 +84,10 @@
      */
     public Object narrow(Class target);
 
+    /**
+     * @return the remote address for this connection
+     *  
+     */
+	public String getRemoteAddress();
+
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportFilter.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportFilter.java?rev=415306&r1=415305&r2=415306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportFilter.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/TransportFilter.java
Mon Jun 19 05:32:59 2006
@@ -108,4 +108,8 @@
         }
         return next.narrow(target);
     }
+
+	public String getRemoteAddress() {
+		return next.getRemoteAddress();
+	}
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/activeio/ActiveIOTransport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/activeio/ActiveIOTransport.java?rev=415306&r1=415305&r2=415306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/activeio/ActiveIOTransport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/activeio/ActiveIOTransport.java
Mon Jun 19 05:32:59 2006
@@ -196,4 +196,13 @@
         return writeCounter;
     }
 
+	public String getRemoteAddress() {
+		SocketMetadata sm = (SocketMetadata) commandChannel.getAdapter(SocketMetadata.class);
+		
+        if (sm != null) {
+            return "" + sm.getRemoteSocketAddress();
+        }
+        return null;
+	}
+
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java?rev=415306&r1=415305&r2=415306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/failover/FailoverTransport.java
Mon Jun 19 05:32:59 2006
@@ -513,4 +513,11 @@
         return connectedTransportURI==null ? "unconnected" : connectedTransportURI.toString();
     }
 
+	public String getRemoteAddress() {
+		if(connectedTransport != null){
+			return connectedTransport.getRemoteAddress();
+		}
+		return null;
+	}
+
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java?rev=415306&r1=415305&r2=415306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/fanout/FanoutTransport.java
Mon Jun 19 05:32:59 2006
@@ -518,4 +518,13 @@
         
     }
 
+	public String getRemoteAddress() {
+		if(primary != null){
+		   if(primary.transport != null){
+			   return primary.transport.getRemoteAddress(); 
+		   }
+		}
+		return null;
+	}
+
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransport.java?rev=415306&r1=415305&r2=415306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/mock/MockTransport.java
Mon Jun 19 05:32:59 2006
@@ -127,6 +127,10 @@
         filter.setTransportListener(this);
         getNext().setTransportListener(filter);
         setNext(filter);
-    }  
+    }
+
+	public String getRemoteAddress() {
+		return next.getRemoteAddress();
+	}  
     
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java?rev=415306&r1=415305&r2=415306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/tcp/TcpTransport.java
Mon Jun 19 05:32:59 2006
@@ -331,4 +331,11 @@
     public void setSocketOptions(Map socketOptions) {
         IntrospectionSupport.setProperties(socket, socketOptions);
     }
+
+	public String getRemoteAddress() {
+		if(socket != null){
+			return "" + socket.getRemoteSocketAddress();
+		}
+		return null;
+	}
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/udp/UdpTransport.java?rev=415306&r1=415305&r2=415306&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
Mon Jun 19 05:32:59 2006
@@ -439,4 +439,11 @@
             return (InetSocketAddress)channel.socket().getLocalSocketAddress();
         }
     }
+
+	public String getRemoteAddress() {
+		if(targetAddress != null){
+			return "" + targetAddress;
+		}
+		return null;
+	}
 }

Modified: incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java?rev=415306&r1=415305&r2=415306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/vm/VMTransport.java
Mon Jun 19 05:32:59 2006
@@ -143,4 +143,11 @@
         return location+"#"+id;
     }
 
+	public String getRemoteAddress() {
+		if(peer != null){
+			return peer.toString();
+		}
+		return null;
+	}
+
 }

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java?rev=415306&r1=415305&r2=415306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/broker/StubConnection.java
Mon Jun 19 05:32:59 2006
@@ -58,6 +58,10 @@
             protected OpenWireFormat getWireFormat() {
                 return wireFormat;
             }
+
+			public String getRemoteAddress() {
+				return null;
+			}
         };
     }
 

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/StubTransport.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/StubTransport.java?rev=415306&r1=415305&r2=415306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/StubTransport.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/StubTransport.java
Mon Jun 19 05:32:59 2006
@@ -46,5 +46,9 @@
         return queue;
     }
 
+	public String getRemoteAddress() {
+		return null;
+	}
+
     
 }

Modified: incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompSubscriptionRemoveTest.java
URL: http://svn.apache.org/viewvc/incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompSubscriptionRemoveTest.java?rev=415306&r1=415305&r2=415306&view=diff
==============================================================================
--- incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompSubscriptionRemoveTest.java
(original)
+++ incubator/activemq/trunk/activemq-core/src/test/java/org/apache/activemq/transport/stomp/StompSubscriptionRemoveTest.java
Mon Jun 19 05:32:59 2006
@@ -73,17 +73,6 @@
         // consumer.close();
         session.close();
         connection.close();
-        broker.stop();
-        while (broker.isStarted()) {
-            Thread.sleep(1000);
-        }
-
-        broker = new BrokerService();
-        broker.setPersistent(true);
-
-        broker.addConnector("stomp://localhost:61613").setName("Stomp");
-        broker.addConnector("tcp://localhost:61616").setName("Default");
-        broker.start();
 
         stompSocket = new Socket("localhost", 61613);
         inputBuffer = new ByteArrayOutputStream();



Mime
View raw message