await closing sockets on shutdown
This commit is contained in:
parent
f993c4b72b
commit
e764f41341
|
@ -324,7 +324,7 @@ public class NettyTransport extends AbstractLifecycleComponent<Transport> implem
|
|||
for (Iterator<NodeChannels> it = connectedNodes.values().iterator(); it.hasNext();) {
|
||||
NodeChannels nodeChannels = it.next();
|
||||
it.remove();
|
||||
nodeChannels.close();
|
||||
nodeChannels.closeAndWait();
|
||||
}
|
||||
|
||||
if (clientBootstrap != null) {
|
||||
|
@ -615,5 +615,23 @@ public class NettyTransport extends AbstractLifecycleComponent<Transport> implem
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void closeAndWait() {
|
||||
closeChannelsAndWait(low);
|
||||
closeChannelsAndWait(med);
|
||||
closeChannelsAndWait(high);
|
||||
}
|
||||
|
||||
private void closeChannelsAndWait(Channel[] channels) {
|
||||
for (Channel channel : channels) {
|
||||
try {
|
||||
if (channel != null && channel.isOpen()) {
|
||||
channel.close().awaitUninterruptibly();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue