Minor fix to make Junit happy. 08/2408/2
authorMadhu Venugopal <mavenugo@gmail.com>
Tue, 5 Nov 2013 18:08:02 +0000 (10:08 -0800)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 6 Nov 2013 18:06:41 +0000 (18:06 +0000)
Due to the introduction of the passive connection support, the Monitor and Schema was pushed to a
separate thread. Also the connection was deemed successful only if the monitor was successful.
That doesnt work well with the current (buggy) implemenation of JUnit. But since the JUnit is very
handy in testing out the functionality, reversing the ovsdbConnection management.

Change-Id: Ifa833014c587e94baa63a5925959c87d9e27c6fc
Signed-off-by: Madhu Venugopal <mavenugo@gmail.com>
ovsdb/src/main/java/org/opendaylight/ovsdb/plugin/ConnectionService.java

index df8b3a5e51450539f49bec7a5a09c0e7ac8bac4d..a41fc02aa039d8fba1493629c57646680e2d3079 100755 (executable)
@@ -213,6 +213,7 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
         OvsdbRPC ovsdb = factory.getClient(node, OvsdbRPC.class);
         connection.setRpc(ovsdb);
         ovsdb.registerCallback(instance);
+        ovsdbConnections.put(identifier, connection);
 
         // Keeping the Initial inventory update(s) on its own thread.
         new Thread() {
@@ -222,11 +223,9 @@ public class ConnectionService implements IPluginInConnectionService, IConnectio
             public void run() {
                 try {
                     initializeInventoryForNewNode(connection);
-                    ovsdbConnections.put(identifier, connection);
-                } catch (InterruptedException e) {
-                    e.printStackTrace();
-                } catch (ExecutionException e) {
+                } catch (Exception e) {
                     e.printStackTrace();
+                    ovsdbConnections.remove(identifier);
                 }
             }
             public Thread initializeConnectionParams(String identifier, Connection connection) {