use of net.dempsy.transport.tcp.TcpAddress in project Dempsy by Dempsy.
the class NioSenderFactory method getSender.
@Override
public NioSender getSender(final NodeAddress destination) throws MessageTransportException {
final TcpAddress tcpaddr = (TcpAddress) destination;
final NioSender ret;
if (isRunning.get()) {
ret = senders.computeIfAbsent(tcpaddr, a -> new NioSender(a, this));
} else
throw new MessageTransportException(nodeId + " sender had getSender called while stopped.");
try {
ret.connect(false);
} catch (final IOException e) {
throw new MessageTransportException(nodeId + " sender failed to connect to " + destination, e);
}
return ret;
}
Aggregations