Merge "Removed `which` dependency, now using proper shell builtin."
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / streams / websockets / WebSocketServer.java
index 16400354205a68cbf6993760f9dfa3fee04ec37a..fcfa8858ee940065baee9f4c8c4df2fb3a73089c 100644 (file)
@@ -16,45 +16,45 @@ import org.slf4j.LoggerFactory;
  */
 public class WebSocketServer implements Runnable {
 
-       private static final Logger logger = LoggerFactory
-                       .getLogger(WebSocketServer.class);
-
-       public static final int PORT = 8181;
-       private EventLoopGroup bossGroup;
-       private EventLoopGroup workerGroup;
-
-       @Override
-       public void run() {
-               bossGroup = new NioEventLoopGroup();
-               workerGroup = new NioEventLoopGroup();
-               try {
-                       ServerBootstrap b = new ServerBootstrap();
-                       b.group(bossGroup, workerGroup)
-                                       .channel(NioServerSocketChannel.class)
-                                       .childHandler(new WebSocketServerInitializer());
-
-                       Channel ch = b.bind(PORT).sync().channel();
-                       logger.info("Web socket server started at port {}.", PORT);
-
-                       ch.closeFuture().sync();
-               } catch (InterruptedException e) {
-                       // NOOP
-               } finally {
-                       stop();
-               }
-       }
-
-       /**
-        * Stops the web socket server and removes all listeners.
-        */
-       private void stop() {
-               Notificator.removeAllListeners();
-               if (bossGroup != null) {
-                       bossGroup.shutdownGracefully();
-               }
-               if (workerGroup != null) {
-                       workerGroup.shutdownGracefully();
-               }
-       }
+    private static final Logger logger = LoggerFactory
+            .getLogger(WebSocketServer.class);
+
+    public static final int PORT = 8181;
+    private EventLoopGroup bossGroup;
+    private EventLoopGroup workerGroup;
+
+    @Override
+    public void run() {
+        bossGroup = new NioEventLoopGroup();
+        workerGroup = new NioEventLoopGroup();
+        try {
+            ServerBootstrap b = new ServerBootstrap();
+            b.group(bossGroup, workerGroup)
+                    .channel(NioServerSocketChannel.class)
+                    .childHandler(new WebSocketServerInitializer());
+
+            Channel ch = b.bind(PORT).sync().channel();
+            logger.info("Web socket server started at port {}.", PORT);
+
+            ch.closeFuture().sync();
+        } catch (InterruptedException e) {
+            // NOOP
+        } finally {
+            stop();
+        }
+    }
+
+    /**
+     * Stops the web socket server and removes all listeners.
+     */
+    private void stop() {
+        Notificator.removeAllListeners();
+        if (bossGroup != null) {
+            bossGroup.shutdownGracefully();
+        }
+        if (workerGroup != null) {
+            workerGroup.shutdownGracefully();
+        }
+    }
 
 }