mirror of
https://github.com/apache/activemq.git
synced 2025-02-15 06:26:44 +00:00
https://issues.apache.org/jira/browse/AMQ-3135 - TcpTransport.getRemoteAddress() better formatting
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1147812 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
2cce056eb4
commit
1acc98bcd5
@ -20,13 +20,7 @@ import java.io.DataInputStream;
|
|||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InterruptedIOException;
|
import java.io.InterruptedIOException;
|
||||||
import java.net.InetAddress;
|
import java.net.*;
|
||||||
import java.net.InetSocketAddress;
|
|
||||||
import java.net.Socket;
|
|
||||||
import java.net.SocketException;
|
|
||||||
import java.net.SocketTimeoutException;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.UnknownHostException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CountDownLatch;
|
import java.util.concurrent.CountDownLatch;
|
||||||
@ -618,7 +612,12 @@ public class TcpTransport extends TransportThreadSupport implements Transport, S
|
|||||||
|
|
||||||
public String getRemoteAddress() {
|
public String getRemoteAddress() {
|
||||||
if (socket != null) {
|
if (socket != null) {
|
||||||
return "" + socket.getRemoteSocketAddress();
|
SocketAddress address = socket.getRemoteSocketAddress();
|
||||||
|
if (address instanceof InetSocketAddress) {
|
||||||
|
return "tcp://" + ((InetSocketAddress)address).getAddress().getHostAddress() + ":" + ((InetSocketAddress)address).getPort();
|
||||||
|
} else {
|
||||||
|
return "" + socket.getRemoteSocketAddress();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user