From ffc0d1a5a29f77e8774359c8380bfacd0ec2f6f0 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Mon, 6 Mar 2023 11:13:32 +0100 Subject: [PATCH] Remove superfluous throws We are only closing a Registration, really. Make sure we preserve that contract to remove the need to throw Exceptions. Change-Id: I1e106c857c3adab572d09ef925a3c74d50247be6 Signed-off-by: Robert Varga --- .../bgp/peer/acceptor/BGPPeerAcceptorImpl.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/bgp/peer-acceptor/src/main/java/org/opendaylight/protocol/bgp/peer/acceptor/BGPPeerAcceptorImpl.java b/bgp/peer-acceptor/src/main/java/org/opendaylight/protocol/bgp/peer/acceptor/BGPPeerAcceptorImpl.java index 837fbefb05..967e0ef0d8 100644 --- a/bgp/peer-acceptor/src/main/java/org/opendaylight/protocol/bgp/peer/acceptor/BGPPeerAcceptorImpl.java +++ b/bgp/peer-acceptor/src/main/java/org/opendaylight/protocol/bgp/peer/acceptor/BGPPeerAcceptorImpl.java @@ -28,6 +28,7 @@ import org.opendaylight.protocol.bgp.rib.impl.spi.PeerRegistryListener; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IetfInetUtil; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber; +import org.opendaylight.yangtools.concepts.Registration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -37,7 +38,7 @@ public final class BGPPeerAcceptorImpl implements AutoCloseable { private final BGPDispatcher bgpDispatcher; private final InetSocketAddress address; private ChannelFuture futureChannel; - private AutoCloseable listenerRegistration; + private Registration listenerRegistration; public BGPPeerAcceptorImpl(final IpAddressNoZone bindingAddress, final PortNumber portNumber, final BGPDispatcher bgpDispatcher) { @@ -78,11 +79,11 @@ public final class BGPPeerAcceptorImpl implements AutoCloseable { } /** - * This closes the acceptor and no new bgp connections will be accepted - * Connections already established will be preserved. - **/ + * This closes the acceptor and no new bgp connections will be accepted. Connections already established will be + * preserved. + */ @Override - public void close() throws Exception { + public void close() { futureChannel.cancel(true); futureChannel.channel().close(); if (listenerRegistration != null) { -- 2.36.6