Merge "BUG-509: introduce Version concept"
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / main / java / org / opendaylight / controller / sal / rest / impl / RestconfProvider.java
index 09cf01091ed0deaa3c3ea5f86d35134d5ae89a84..2abd4b6a3ab5b9a08c56e782257a262db80fbfe2 100644 (file)
@@ -1,3 +1,10 @@
+/*
+ * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ */
 package org.opendaylight.controller.sal.rest.impl;
 
 import java.util.Collection;
@@ -11,6 +18,7 @@ import org.opendaylight.controller.sal.core.api.model.SchemaService;
 import org.opendaylight.controller.sal.core.api.mount.MountService;
 import org.opendaylight.controller.sal.restconf.impl.BrokerFacade;
 import org.opendaylight.controller.sal.restconf.impl.ControllerContext;
+import org.opendaylight.controller.sal.streams.websockets.WebSocketServer;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.opendaylight.yangtools.yang.model.api.SchemaServiceListener;
 import org.osgi.framework.BundleActivator;
@@ -26,7 +34,7 @@ public class RestconfProvider implements BundleActivator, Provider, ServiceTrack
     private ListenerRegistration<SchemaServiceListener> listenerRegistration;
     private ServiceTracker<Broker, Broker> brokerServiceTrancker;
     private BundleContext bundleContext;
-    private ProviderSession session;
+    private Thread webSocketServerThread;
 
     @Override
     public void onSessionInitiated(ProviderSession session) {
@@ -46,6 +54,9 @@ public class RestconfProvider implements BundleActivator, Provider, ServiceTrack
         bundleContext = context;
         brokerServiceTrancker = new ServiceTracker<>(context, Broker.class, this);
         brokerServiceTrancker.open();
+        webSocketServerThread = new Thread(new WebSocketServer());
+        webSocketServerThread.setName("Web socket server");
+        webSocketServerThread.start();
     }
 
     @Override
@@ -57,7 +68,7 @@ public class RestconfProvider implements BundleActivator, Provider, ServiceTrack
                 e.printStackTrace();
             }
         }
-        session.close();
+        webSocketServerThread.interrupt();
         brokerServiceTrancker.close();
     }