From: Abhijit Kumbhare Date: Thu, 23 Jun 2016 07:56:18 +0000 (+0000) Subject: Merge "Suppressed WARN log of forwardingrules-manager" X-Git-Tag: release/boron~147 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=b3d6e4be6a563e722ab175984f3b8abdcbd4c2a9;hp=697d0c74c88b29f6974140fe247d36fe74348000;p=openflowplugin.git Merge "Suppressed WARN log of forwardingrules-manager" --- diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/HandshakeContextImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/HandshakeContextImpl.java index e7142642b8..1efadcc18b 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/HandshakeContextImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/HandshakeContextImpl.java @@ -8,19 +8,13 @@ package org.opendaylight.openflowplugin.impl.connection; import java.util.concurrent.ThreadPoolExecutor; -import java.util.concurrent.TimeUnit; import org.opendaylight.openflowplugin.api.openflow.connection.HandshakeContext; import org.opendaylight.openflowplugin.api.openflow.md.core.HandshakeManager; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * */ public class HandshakeContextImpl implements HandshakeContext { - - private static final Logger LOG = LoggerFactory.getLogger(HandshakeContextImpl.class); - private ThreadPoolExecutor handshakePool; private HandshakeManager handshakeManager; @@ -44,23 +38,6 @@ public class HandshakeContextImpl implements HandshakeContext { } @Override - public void close() throws Exception { - shutdownPoolPolitely(); - } - - private void shutdownPoolPolitely() { - LOG.debug("terminating handshake pool"); - handshakePool.shutdown(); - try { - handshakePool.awaitTermination(1, TimeUnit.SECONDS); - } catch (InterruptedException e) { - LOG.error("Error while awaiting termination on pool. Will use shutdownNow method."); - } finally { - handshakePool.purge(); - if (! handshakePool.isTerminated()) { - handshakePool.shutdownNow(); - } - LOG.debug("pool is terminated: {}", handshakePool.isTerminated()); - } + public void close() { } } diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/session/SessionManagerOFImpl.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/session/SessionManagerOFImpl.java index 1a5f53857a..67cc3efce7 100644 --- a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/session/SessionManagerOFImpl.java +++ b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/session/SessionManagerOFImpl.java @@ -99,13 +99,18 @@ public class SessionManagerOFImpl implements ConjunctSessionManager { LOG.info("context for invalidation not found"); } else { synchronized (context) { - for (Entry auxEntry : context.getAuxiliaryConductors()) { - invalidateAuxiliary(sessionKey, auxEntry.getKey()); + if (context.isValid()) { + for (Entry auxEntry : context.getAuxiliaryConductors()) { + invalidateAuxiliary(sessionKey, auxEntry.getKey()); + } + context.getPrimaryConductor().disconnect(); + context.setValid(false); + removeSessionContext(context); + // TODO:: notify listeners + } else { + LOG.warn("Ignore invalid session context: {}", + Arrays.toString(sessionKey.getId())); } - context.getPrimaryConductor().disconnect(); - context.setValid(false); - removeSessionContext(context); - // TODO:: notify listeners } } } @@ -115,13 +120,19 @@ public class SessionManagerOFImpl implements ConjunctSessionManager { LOG.info("context for invalidation not found"); } else { synchronized (sessionContext) { - for (Entry auxEntry : sessionContext - .getAuxiliaryConductors()) { - invalidateAuxiliary(sessionContext, auxEntry.getKey(), true); + if (sessionContext.isValid()) { + for (Entry auxEntry : sessionContext + .getAuxiliaryConductors()) { + invalidateAuxiliary(sessionContext, auxEntry.getKey(), true); + } + sessionContext.setValid(false); + removeSessionContext(sessionContext); + // TODO:: notify listeners + } else { + LOG.warn("Ignore invalid dead session context: {}", + Arrays.toString( + sessionContext.getSessionKey().getId())); } - sessionContext.setValid(false); - removeSessionContext(sessionContext); - // TODO:: notify listeners } } } @@ -130,8 +141,13 @@ public class SessionManagerOFImpl implements ConjunctSessionManager { if (LOG.isDebugEnabled()) { LOG.debug("removing session: {}", Arrays.toString(sessionContext.getSessionKey().getId())); } - sessionLot.remove(sessionContext.getSessionKey(), sessionContext); - sessionNotifier.onSessionRemoved(sessionContext); + if (sessionLot.remove(sessionContext.getSessionKey(), sessionContext)) { + sessionNotifier.onSessionRemoved(sessionContext); + } else { + // This should never happen. + LOG.warn("Ignore session context that was already removed: {}", + Arrays.toString(sessionContext.getSessionKey().getId())); + } } @Override