X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=bgpmanager%2Fbgpmanager-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fbgpmanager%2Fthrift%2Fserver%2Fimplementation%2FBgpThriftService.java;fp=bgpmanager%2Fbgpmanager-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fbgpmanager%2Fthrift%2Fserver%2Fimplementation%2FBgpThriftService.java;h=dfe4af646d97f2907c2f8b39c1cd6bd5d81ea699;hb=2b4b84840b238b051375c990611949cf60f18a0c;hp=c6d01195c109050a2331b335a074060502e5f499;hpb=787d5375bafae2644824daeb31658953e61e6611;p=vpnservice.git diff --git a/bgpmanager/bgpmanager-impl/src/main/java/org/opendaylight/bgpmanager/thrift/server/implementation/BgpThriftService.java b/bgpmanager/bgpmanager-impl/src/main/java/org/opendaylight/bgpmanager/thrift/server/implementation/BgpThriftService.java index c6d01195..dfe4af64 100644 --- a/bgpmanager/bgpmanager-impl/src/main/java/org/opendaylight/bgpmanager/thrift/server/implementation/BgpThriftService.java +++ b/bgpmanager/bgpmanager-impl/src/main/java/org/opendaylight/bgpmanager/thrift/server/implementation/BgpThriftService.java @@ -14,14 +14,12 @@ import org.slf4j.LoggerFactory; public class BgpThriftService { - private static final Logger logger = LoggerFactory.getLogger(BgpThriftService.class); + private static final Logger LOGGER = LoggerFactory.getLogger(BgpThriftService.class); private int port; - //private int serverType; private int maxWorkerThreads; private int minWorkerThreads; private TServerTransport serverTransport; - //private TNonblockingServerTransport serverTransport; private TServer server; private BgpUpdateHandler notificationHandler; private BgpManager bgpManager; @@ -29,17 +27,16 @@ public class BgpThriftService { public BgpThriftService(BgpManager bgpMgr, FibDSWriter dsWriter) { bgpManager = bgpMgr; notificationHandler = new BgpUpdateHandler(bgpManager, dsWriter); - //fibDSWriter = dsWriter; } public void start() { - logger.info("BGP Thrift Server starting."); + LOGGER.info("BGP Thrift Server starting."); startBgpThriftServer(); } public void stop() { - logger.info("BGP Thrift Server stopping."); + LOGGER.info("BGP Thrift Server stopping."); stopBgpThriftServer(); } @@ -47,7 +44,7 @@ public class BgpThriftService { * Destroy method called up after the bundle has been stopped */ public void destroy() { - logger.debug("BGP Thrift Server destroy "); + LOGGER.debug("BGP Thrift Server destroy "); } /** @@ -71,7 +68,7 @@ public class BgpThriftService { public void stopBgpThriftServer() { try { - logger.debug("Server stopping"); + LOGGER.debug("Server stopping"); if (serverTransport != null) { serverTransport.close(); @@ -79,21 +76,19 @@ public class BgpThriftService { server.stop(); } catch (Exception e) { - logger.error("Error while stopping the server - {} {}", getClass().getName(), e.getMessage()); + LOGGER.error("Error while stopping the server - {} {}", getClass().getName(), e.getMessage()); } } private class ThriftRunnable implements Runnable { @Override public void run() { - //notificationHandler = new BgpUpdateHandler(bgpManager); try { serverTransport = new TServerSocket(port); - //serverTransport = new TNonblockingServerSocket(port); - logger.info("Server Socket on Port {} ", port); - } catch (TTransportException e) { - e.printStackTrace(); + LOGGER.info("Server Socket on Port {} ", port); + } catch (TTransportException e) { + LOGGER.error("Transport Exception while starting bgp thrift server", e); return; } /* This may need to change. Right now, its as good as a blocking server for each client (client would be @@ -103,11 +98,6 @@ public class BgpThriftService { server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport) .maxWorkerThreads(maxWorkerThreads).minWorkerThreads(minWorkerThreads) .processor(new BgpUpdater.Processor(notificationHandler))); - /* - THsHaServer.Args args = new THsHaServer.Args(serverTransport); - args.workerThreads(10); - server = new THsHaServer(args.processor(new BgpUpdater.Processor(notificationHandler)));*/ - server.serve(); } }