Moderinize algo-impl
[bgpcep.git] / algo / algo-impl / src / main / java / org / opendaylight / algo / impl / PathComputationServer.java
index ca6a89498c4d55fe314371e53ab3888cf75fd215..1ab7b7e1ecfe1c8dfd65957ff4c5d083b88e372d 100644 (file)
@@ -9,7 +9,6 @@ package org.opendaylight.algo.impl;
 
 import static java.util.Objects.requireNonNull;
 
-import com.google.common.collect.ImmutableClassToInstanceMap;
 import com.google.common.util.concurrent.ListenableFuture;
 import javax.annotation.PreDestroy;
 import javax.inject.Inject;
@@ -45,7 +44,7 @@ import org.slf4j.LoggerFactory;
  */
 @Singleton
 @Component(immediate = true, service = PathComputationProvider.class)
-public final class PathComputationServer implements AutoCloseable, PathComputationProvider {
+public final class PathComputationServer implements AutoCloseable, PathComputationProvider, GetConstrainedPath {
     private static final Logger LOG = LoggerFactory.getLogger(PathComputationServer.class);
 
     private final ConnectedGraphProvider graphProvider;
@@ -56,12 +55,11 @@ public final class PathComputationServer implements AutoCloseable, PathComputati
     public PathComputationServer(@Reference final RpcProviderService rpcService,
             @Reference final ConnectedGraphProvider graphProvider) {
         this.graphProvider = requireNonNull(graphProvider);
-        registration = rpcService.registerRpcImplementations(
-            ImmutableClassToInstanceMap.of(GetConstrainedPath.class, this::getConstrainedPath));
+        registration = rpcService.registerRpcImplementation(this);
     }
 
-    private ListenableFuture<RpcResult<GetConstrainedPathOutput>> getConstrainedPath(
-            final GetConstrainedPathInput input) {
+    @Override
+    public ListenableFuture<RpcResult<GetConstrainedPathOutput>> invoke(final GetConstrainedPathInput input) {
         final GetConstrainedPathOutputBuilder output = new GetConstrainedPathOutputBuilder();
 
         LOG.info("Got Path Computation Service request");