-
- private final PathComputationService pathComputationService;
-
- public PceServiceRPCImpl(PathComputationService pathComputationService) {
- this.pathComputationService = pathComputationService;
- }
-
- @Override
- public ListenableFuture<RpcResult<CancelResourceReserveOutput>>
- cancelResourceReserve(CancelResourceReserveInput input) {
- LOG.info("RPC cancelResourceReserve request received");
- try {
- return RpcResultBuilder
- .success(
- this.pathComputationService.cancelResourceReserve(input).get())
- .buildFuture();
- } catch (InterruptedException | ExecutionException e) {
- LOG.error("RPC cancelResourceReserve failed !", e);
- return RpcResultBuilder.success((CancelResourceReserveOutput) null).buildFuture();
- }
+ private Registration reg;
+
+ @Activate
+ public PceServiceRPCImpl(@Reference RpcProviderService rpcProviderService,
+ @Reference PathComputationService pathComputationService) {
+ this.reg = rpcProviderService.registerRpcImplementations(ImmutableClassToInstanceMap.<Rpc<?, ?>>builder()
+ .put(CancelResourceReserve.class, new CancelResourceReserveImpl(pathComputationService))
+ .put(PathComputationRequest.class, new PathComputationRequestImpl(pathComputationService))
+ .put(PathComputationRerouteRequest.class, new PathComputationRerouteRequestImpl(pathComputationService))
+ .build());
+ LOG.info("PceServiceRPCImpl instantiated");