This commit is contained in:
@@ -335,6 +335,7 @@ public abstract class NodeServer {
|
||||
}
|
||||
if (transport == null) {
|
||||
transport = new Transport(group + "_" + application.transports.size(), protocol, application.getWatchFactory(), 32, addrs);
|
||||
logger.info(transport + " created");
|
||||
application.transports.add(transport);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,7 +133,9 @@ public final class Transport {
|
||||
}
|
||||
|
||||
public AsyncConnection pollConnection(SocketAddress addr) {
|
||||
if (addr == null && remoteAddres.length == 1) addr = remoteAddres[0];
|
||||
final boolean rand = addr == null;
|
||||
if (rand && remoteAddres.length < 1) throw new RuntimeException("Transport (" + this.name + ") has no remoteAddress list");
|
||||
try {
|
||||
if ("TCP".equalsIgnoreCase(protocol)) {
|
||||
AsynchronousSocketChannel channel = null;
|
||||
@@ -165,7 +167,7 @@ public final class Transport {
|
||||
index.set(p);
|
||||
} else {
|
||||
channel = AsynchronousSocketChannel.open(group);
|
||||
channel.connect(addr).get(1, TimeUnit.SECONDS);
|
||||
channel.connect(addr).get(2, TimeUnit.SECONDS);
|
||||
}
|
||||
if (channel == null) return null;
|
||||
return AsyncConnection.create(channel, addr, 3000, 3000);
|
||||
|
||||
@@ -234,7 +234,7 @@ public final class SncpClient {
|
||||
final SocketAddress addr = action.addressParamIndex >= 0 ? (SocketAddress) params[action.addressParamIndex] : null;
|
||||
final AsyncConnection conn = transport.pollConnection(addr);
|
||||
if (conn == null || !conn.isOpen()) {
|
||||
logger.log(Level.SEVERE, action.method + " sncp (params: " + jsonConvert.convertTo(params) + ") cannot connect");
|
||||
logger.log(Level.SEVERE, action.method + " sncp (params: " + jsonConvert.convertTo(params) + ") cannot connect " + (conn == null ? addr : conn.getRemoteAddress()));
|
||||
throw new RuntimeException("sncp " + (conn == null ? addr : conn.getRemoteAddress()) + " cannot connect");
|
||||
}
|
||||
|
||||
@@ -306,7 +306,7 @@ public final class SncpClient {
|
||||
final SocketAddress addr = action.addressParamIndex >= 0 ? (SocketAddress) params[action.addressParamIndex] : null;
|
||||
final AsyncConnection conn = transport.pollConnection(addr);
|
||||
if (conn == null || !conn.isOpen()) {
|
||||
logger.log(Level.SEVERE, action.method + " sncp (params: " + jsonConvert.convertTo(params) + ") cannot connect");
|
||||
logger.log(Level.SEVERE, action.method + " sncp (params: " + jsonConvert.convertTo(params) + ") cannot connect " + (conn == null ? addr : conn.getRemoteAddress()));
|
||||
throw new RuntimeException("sncp " + (conn == null ? addr : conn.getRemoteAddress()) + " cannot connect");
|
||||
}
|
||||
final ByteBuffer[] sendBuffers = writer.toBuffers();
|
||||
|
||||
Reference in New Issue
Block a user