Make RPC implementations return ListenableFuture
[mdsal.git] / binding / yang-binding / src / main / java / org / opendaylight / yangtools / yang / binding / util / AbstractMappedRpcInvoker.java
index af429736a9f19b0d61d689309df4f902e3aad1ff..a480b482b11168682dce00628d8af2610d00bf71 100644 (file)
@@ -7,13 +7,14 @@
  */
 package org.opendaylight.yangtools.yang.binding.util;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.ImmutableMap.Builder;
+import com.google.common.util.concurrent.ListenableFuture;
 import java.lang.reflect.Method;
 import java.util.Map;
 import java.util.Map.Entry;
-import java.util.concurrent.Future;
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 import org.opendaylight.yangtools.yang.binding.DataObject;
@@ -25,7 +26,9 @@ import org.slf4j.LoggerFactory;
 
 abstract class AbstractMappedRpcInvoker<T> extends RpcServiceInvoker {
     private static final Logger LOG = LoggerFactory.getLogger(AbstractMappedRpcInvoker.class);
-    private final Map<T, RpcMethodInvoker> map;
+
+    @VisibleForTesting
+    final Map<T, RpcMethodInvoker> map;
 
     protected AbstractMappedRpcInvoker(final Map<T, Method> map) {
         final Builder<T, RpcMethodInvoker> b = ImmutableMap.builder();
@@ -44,7 +47,7 @@ abstract class AbstractMappedRpcInvoker<T> extends RpcServiceInvoker {
     protected abstract T qnameToKey(QName qname);
 
     @Override
-    public final Future<RpcResult<?>> invokeRpc(@Nonnull final RpcService impl, @Nonnull final QName rpcName,
+    public final ListenableFuture<RpcResult<?>> invokeRpc(@Nonnull final RpcService impl, @Nonnull final QName rpcName,
             @Nullable final DataObject input) {
         Preconditions.checkNotNull(impl, "Implementation must be supplied");