Fix checkstyle
[openflowplugin.git] / applications / forwardingrules-sync / src / main / java / org / opendaylight / openflowplugin / applications / frsync / impl / clustering / DeviceMastershipManager.java
index 06532ad3c2f821268a972c5a5d63b650dd8d41c8..1f5d289bf25fae25a69b57dcf3949fe524d32fac 100644 (file)
@@ -5,13 +5,11 @@
  * 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.openflowplugin.applications.frsync.impl.clustering;
 
 import com.google.common.annotations.VisibleForTesting;
 import java.util.concurrent.ConcurrentHashMap;
 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
-import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration;
 import org.opendaylight.openflowplugin.applications.frsync.util.ReconciliationRegistry;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
 import org.slf4j.Logger;
@@ -33,23 +31,16 @@ public class DeviceMastershipManager {
     }
 
     public void onDeviceConnected(final NodeId nodeId) {
-        final DeviceMastership mastership = new DeviceMastership(nodeId, reconciliationRegistry);
-        final ClusterSingletonServiceRegistration registration = clusterSingletonService.registerClusterSingletonService(mastership);
-        mastership.setClusterSingletonServiceRegistration(registration);
-        deviceMasterships.put(nodeId, mastership);
         LOG.debug("FRS service registered for: {}", nodeId.getValue());
+        final DeviceMastership mastership = new DeviceMastership(nodeId, reconciliationRegistry,
+                clusterSingletonService);
+        deviceMasterships.put(nodeId, mastership);
     }
 
-
     public void onDeviceDisconnected(final NodeId nodeId) {
         final DeviceMastership mastership = deviceMasterships.remove(nodeId);
-        final ClusterSingletonServiceRegistration registration = mastership.getClusterSingletonServiceRegistration();
-        if (registration != null) {
-            try {
-                registration.close();
-            } catch (Exception e) {
-                LOG.error("FRS cluster service close fail: {} {}", nodeId.getValue(), e);
-            }
+        if (mastership != null) {
+            mastership.close();
         }
         LOG.debug("FRS service unregistered for: {}", nodeId.getValue());
     }