Merge "Use String(byte[], Charset)"
[openflowplugin.git] / openflowjava / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / core / connection / AbstractConnectionAdapter.java
index 151d25c1445b17f57a0ef8510e26772475d3c3b8..7544368d5bcdbb0113fd3099da4e2a71fcfe0b29 100644 (file)
@@ -5,11 +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.openflowjava.protocol.impl.core.connection;
 
+import static java.util.Objects.requireNonNull;
+
 import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
 import com.google.common.cache.Cache;
 import com.google.common.cache.CacheBuilder;
 import com.google.common.cache.RemovalCause;
@@ -22,8 +22,8 @@ import java.net.InetSocketAddress;
 import java.util.concurrent.Future;
 import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.TimeUnit;
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.jdt.annotation.Nullable;
 import org.opendaylight.openflowjava.protocol.api.connection.ConnectionAdapter;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierInput;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.BarrierOutput;
@@ -99,9 +99,9 @@ abstract class AbstractConnectionAdapter implements ConnectionAdapter {
     protected Cache<RpcResponseKey, ResponseExpectedRpcListener<?>> responseCache;
 
 
-    AbstractConnectionAdapter(@Nonnull final Channel channel, @Nullable final InetSocketAddress address,
+    AbstractConnectionAdapter(@NonNull final Channel channel, @Nullable final InetSocketAddress address,
                               @Nullable final int channelOutboundQueueSize) {
-        this.channel = Preconditions.checkNotNull(channel);
+        this.channel = requireNonNull(channel);
         this.address = address;
 
         responseCache = CacheBuilder.newBuilder().concurrencyLevel(1)
@@ -276,7 +276,7 @@ abstract class AbstractConnectionAdapter implements ConnectionAdapter {
     protected <I extends OfHeader, O extends OfHeader> ListenableFuture<RpcResult<O>>
             sendToSwitchExpectRpcResultFuture(final I input, final Class<O> responseClazz,
                     final String failureInfo) {
-        final RpcResponseKey key = new RpcResponseKey(input.getXid(), responseClazz.getName());
+        final RpcResponseKey key = new RpcResponseKey(input.getXid().toJava(), responseClazz.getName());
         final ResponseExpectedRpcListener<O> listener = new ResponseExpectedRpcListener<>(input, failureInfo,
                 responseCache, key);
         return enqueueMessage(listener);