Fix CS warnings in sal-remoterpc-connector and enable enforcement
[controller.git] / opendaylight / md-sal / sal-remoterpc-connector / src / main / java / org / opendaylight / controller / remote / rpc / RemoteRpcProvider.java
index 80aebd1918a33e5fa588ec13348e11a4515f32e3..52f803d5429d44d0b60bd1c7bc7c6ac161fa9e33 100644 (file)
@@ -31,68 +31,66 @@ import org.slf4j.LoggerFactory;
  */
 public class RemoteRpcProvider implements AutoCloseable, Provider, SchemaContextListener {
 
-  private static final Logger LOG = LoggerFactory.getLogger(RemoteRpcProvider.class);
-
-  private final DOMRpcProviderService rpcProvisionRegistry;
-
-  private ListenerRegistration<SchemaContextListener> schemaListenerRegistration;
-  private final ActorSystem actorSystem;
-  private SchemaService schemaService;
-  private DOMRpcService rpcService;
-  private SchemaContext schemaContext;
-  private ActorRef rpcManager;
-  private final RemoteRpcProviderConfig config;
-
-
-  public RemoteRpcProvider(final ActorSystem actorSystem,
-                           final DOMRpcProviderService rpcProvisionRegistry,
-                           final RemoteRpcProviderConfig config) {
-    this.actorSystem = actorSystem;
-    this.rpcProvisionRegistry = rpcProvisionRegistry;
-    this.config = Preconditions.checkNotNull(config);
-  }
-
-  public void setRpcService(DOMRpcService rpcService) {
-      this.rpcService = rpcService;
-  }
-
-  public void setSchemaService(SchemaService schemaService) {
-      this.schemaService = schemaService;
-  }
-
-  @Override
-  public void close() throws Exception {
-    if (schemaListenerRegistration != null) {
-        schemaListenerRegistration.close();
-        schemaListenerRegistration = null;
+    private static final Logger LOG = LoggerFactory.getLogger(RemoteRpcProvider.class);
+
+    private final DOMRpcProviderService rpcProvisionRegistry;
+
+    private ListenerRegistration<SchemaContextListener> schemaListenerRegistration;
+    private final ActorSystem actorSystem;
+    private SchemaService schemaService;
+    private DOMRpcService rpcService;
+    private SchemaContext schemaContext;
+    private ActorRef rpcManager;
+    private final RemoteRpcProviderConfig config;
+
+    public RemoteRpcProvider(final ActorSystem actorSystem, final DOMRpcProviderService rpcProvisionRegistry,
+            final RemoteRpcProviderConfig config) {
+        this.actorSystem = actorSystem;
+        this.rpcProvisionRegistry = rpcProvisionRegistry;
+        this.config = Preconditions.checkNotNull(config);
+    }
+
+    public void setRpcService(DOMRpcService rpcService) {
+        this.rpcService = rpcService;
+    }
+
+    public void setSchemaService(SchemaService schemaService) {
+        this.schemaService = schemaService;
+    }
+
+    @Override
+    public void close() throws Exception {
+        if (schemaListenerRegistration != null) {
+            schemaListenerRegistration.close();
+            schemaListenerRegistration = null;
+        }
+    }
+
+    @Override
+    public void onSessionInitiated(final Broker.ProviderSession session) {
+        schemaService = session.getService(SchemaService.class);
+        rpcService = session.getService(DOMRpcService.class);
+        start();
+    }
+
+    @Override
+    public Collection<ProviderFunctionality> getProviderFunctionality() {
+        return null;
+    }
+
+    public void start() {
+        LOG.info("Starting remote rpc service...");
+
+        schemaContext = schemaService.getGlobalContext();
+        rpcManager = actorSystem.actorOf(RpcManager.props(schemaContext, rpcProvisionRegistry, rpcService, config),
+                config.getRpcManagerName());
+        schemaListenerRegistration = schemaService.registerSchemaContextListener(this);
+        LOG.debug("rpc manager started");
+    }
+
+    @Override
+    public void onGlobalContextUpdated(final SchemaContext newSchemaContext) {
+        this.schemaContext = newSchemaContext;
+        rpcManager.tell(new UpdateSchemaContext(newSchemaContext), null);
     }
-  }
-
-  @Override
-  public void onSessionInitiated(final Broker.ProviderSession session) {
-    schemaService = session.getService(SchemaService.class);
-    rpcService = session.getService(DOMRpcService.class);
-    start();
-  }
-
-  @Override
-  public Collection<ProviderFunctionality> getProviderFunctionality() {
-    return null;
-  }
-
-  public void start() {
-    LOG.info("Starting remote rpc service...");
-
-    schemaContext = schemaService.getGlobalContext();
-    rpcManager = actorSystem.actorOf(RpcManager.props(schemaContext,
-            rpcProvisionRegistry, rpcService, config), config.getRpcManagerName());
-    schemaListenerRegistration = schemaService.registerSchemaContextListener(this);
-    LOG.debug("rpc manager started");
-  }
-
-  @Override
-  public void onGlobalContextUpdated(final SchemaContext schemaContext) {
-    this.schemaContext = schemaContext;
-    rpcManager.tell(new UpdateSchemaContext(schemaContext), null);
-  }
 }