From e8c5df4f582ceadbe6cfea719a2308cc26058e78 Mon Sep 17 00:00:00 2001 From: Jozef Bacigal Date: Tue, 13 Jun 2017 08:34:19 +0200 Subject: [PATCH] Fix SwitchIdleEvent echo request-reply xid - changed static Long to static Xid Change-Id: Ib6540078c8143ce6fbe53a4cf379a0b285d53a1e Solves: Bug-4422 Signed-off-by: Jozef Bacigal --- .../listener/SystemNotificationsListenerImpl.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/listener/SystemNotificationsListenerImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/listener/SystemNotificationsListenerImpl.java index b32e259842..5f7a8e9d04 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/listener/SystemNotificationsListenerImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/listener/SystemNotificationsListenerImpl.java @@ -11,6 +11,7 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; import java.net.InetSocketAddress; import java.util.Date; +import java.util.Objects; import java.util.concurrent.Future; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit; @@ -34,7 +35,7 @@ import org.slf4j.LoggerFactory; public class SystemNotificationsListenerImpl implements SystemNotificationsListener { private static final Logger LOG = LoggerFactory.getLogger(SystemNotificationsListenerImpl.class); - private static final long ECHO_XID = 0L; + private static final Xid ECHO_XID = new Xid(0L); private final ConnectionContext connectionContext; @VisibleForTesting @@ -73,14 +74,14 @@ public class SystemNotificationsListenerImpl implements SystemNotificationsListe connectionContext.changeStateToTimeouting(); EchoInputBuilder builder = new EchoInputBuilder(); builder.setVersion(features.getVersion()); - Xid xid = new Xid(ECHO_XID); - builder.setXid(xid.getValue()); + builder.setXid(ECHO_XID.getValue()); Future> echoReplyFuture = connectionContext.getConnectionAdapter().echo(builder.build()); try { RpcResult echoReplyValue = echoReplyFuture.get(echoReplyTimeout, TimeUnit.MILLISECONDS); - if (echoReplyValue.isSuccessful() && echoReplyValue.getResult().getXid() == ECHO_XID) { + if (echoReplyValue.isSuccessful() && + Objects.equals(echoReplyValue.getResult().getXid(), ECHO_XID.getValue())) { connectionContext.changeStateToWorking(); shouldBeDisconnected = false; } else { -- 2.36.6