mirror of https://github.com/apache/activemq.git
Added a way to get the socket address that a transport server is accepting connection on. Needed by gbean modules.
git-svn-id: https://svn.apache.org/repos/asf/incubator/activemq/trunk@388202 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
d36c1fd2cc
commit
26bb18ba8c
|
@ -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 @@ public interface TransportServer extends Service {
|
|||
*
|
||||
* @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 @@ public interface TransportServer extends Service {
|
|||
*
|
||||
* @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();
|
||||
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*/
|
||||
package org.apache.activemq.transport;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.URI;
|
||||
|
||||
import org.apache.activemq.command.BrokerInfo;
|
||||
|
@ -50,5 +51,9 @@ public class TransportServerFilter implements TransportServer {
|
|||
public void stop() throws Exception {
|
||||
next.stop();
|
||||
}
|
||||
|
||||
public InetSocketAddress getSocketAddress() {
|
||||
return next.getSocketAddress();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
@ -112,6 +113,11 @@ public class ActiveIOTransportServer implements TransportServer {
|
|||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ import org.apache.commons.logging.LogFactory;
|
|||
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketTimeoutException;
|
||||
|
@ -212,4 +213,8 @@ public class TcpTransportServer extends TransportServerThreadSupport {
|
|||
serverSocket.close();
|
||||
}
|
||||
}
|
||||
|
||||
public InetSocketAddress getSocketAddress() {
|
||||
return (InetSocketAddress)serverSocket.getLocalSocketAddress();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -431,4 +431,12 @@ public class UdpTransport extends TransportThreadSupport implements Transport, S
|
|||
protected void setChannel(DatagramChannel channel) {
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
public InetSocketAddress getLocalSocketAddress() {
|
||||
if( channel==null ) {
|
||||
return null;
|
||||
} else {
|
||||
return (InetSocketAddress)channel.socket().getLocalSocketAddress();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@ import org.apache.commons.logging.Log;
|
|||
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;
|
||||
|
@ -180,4 +181,8 @@ public class UdpTransportServer extends TransportServerSupport {
|
|||
return wireFormatNegotiator;
|
||||
*/
|
||||
}
|
||||
|
||||
public InetSocketAddress getSocketAddress() {
|
||||
return serverTransport.getLocalSocketAddress();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
@ -128,4 +129,8 @@ public class VMTransportServer implements TransportServer {
|
|||
|
||||
public void setBrokerInfo(BrokerInfo brokerInfo) {
|
||||
}
|
||||
|
||||
public InetSocketAddress getSocketAddress() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue