Call onClose listener in a finally block
This commit is contained in:
parent
279a18a527
commit
e8e2ccdcf5
|
@ -411,8 +411,11 @@ public abstract class TcpTransport<Channel> extends AbstractLifecycleComponent i
|
||||||
@Override
|
@Override
|
||||||
public synchronized void close() throws IOException {
|
public synchronized void close() throws IOException {
|
||||||
if (closed.compareAndSet(false, true)) {
|
if (closed.compareAndSet(false, true)) {
|
||||||
closeChannels(Arrays.stream(channels).filter(Objects::nonNull).collect(Collectors.toList()));
|
try {
|
||||||
onClose.accept(this);
|
closeChannels(Arrays.stream(channels).filter(Objects::nonNull).collect(Collectors.toList()));
|
||||||
|
} finally {
|
||||||
|
onClose.accept(this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue