Fix Sonar warnings: bgp-bmp-impl 97/23497/2
authorIveta Halanova <iveta.halanova@pantheon.sk>
Mon, 29 Jun 2015 06:26:41 +0000 (08:26 +0200)
committerGerrit Code Review <gerrit@opendaylight.org>
Mon, 29 Jun 2015 10:22:14 +0000 (10:22 +0000)
Change-Id: I50a3d1c10204cd421246a0d5f838bcfd83e3ff9d
Signed-off-by: Iveta Halanova <iveta.halanova@pantheon.sk>
bgp/bmp-impl/src/main/java/org/opendaylight/protocol/bmp/impl/BmpDispatcherImpl.java
bgp/bmp-impl/src/main/java/org/opendaylight/protocol/bmp/impl/session/BmpSessionImpl.java

index 53228b6e4e94311daedb744d2df90e34bd9370a2..a14fd57573909351e605ef72d091c20796ace9b9 100644 (file)
@@ -32,6 +32,7 @@ import org.slf4j.LoggerFactory;
 public class BmpDispatcherImpl implements BmpDispatcher {
 
     private static final Logger LOG = LoggerFactory.getLogger(BmpDispatcherImpl.class);
+    private static final int MAX_CONNECTIONS_COUNT = 128;
 
     private final BmpHandlerFactory hf;
     private final EventLoopGroup bossGroup;
@@ -62,7 +63,7 @@ public class BmpDispatcherImpl implements BmpDispatcher {
             }
         });
 
-        b.option(ChannelOption.SO_BACKLOG, 128);
+        b.option(ChannelOption.SO_BACKLOG, MAX_CONNECTIONS_COUNT);
         b.childOption(ChannelOption.ALLOCATOR, PooledByteBufAllocator.DEFAULT);
 
         if (keys.isPresent()) {
index 80cd5f5be4133b395664f2fa04fb540378d833fe..da83ac78c1d87cc7b188864959a3d7127da83c52 100644 (file)
@@ -57,7 +57,7 @@ public final class BmpSessionImpl extends SimpleChannelInboundHandler<Notificati
         try {
             super.channelInactive(ctx);
         } catch (final Exception e) {
-            throw new RuntimeException("Failed to delegate channel inactive event on channel " + ctx.channel(), e);
+            throw new IllegalStateException("Failed to delegate channel inactive event on channel " + ctx.channel(), e);
         }
     }
 
@@ -84,7 +84,7 @@ public final class BmpSessionImpl extends SimpleChannelInboundHandler<Notificati
     }
 
     @Override
-    public final String toString() {
+    public String toString() {
         return addToStringAttributes(MoreObjects.toStringHelper(this)).toString();
     }
 
@@ -116,7 +116,7 @@ public final class BmpSessionImpl extends SimpleChannelInboundHandler<Notificati
         }
     }
 
-    private static Reason getTerminationReason(TerminationMessage terminationMessage) {
+    private static Reason getTerminationReason(final TerminationMessage terminationMessage) {
         final Tlvs tlvs = terminationMessage.getTlvs();
         if (tlvs != null && tlvs.getReasonTlv() != null) {
             return tlvs.getReasonTlv().getReason();