X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=netconf%2Fnetconf-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fclient%2FSimpleNetconfClientSessionListener.java;fp=netconf%2Fnetconf-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fnetconf%2Fclient%2FSimpleNetconfClientSessionListener.java;h=14b2bdf98028ec8000d503857eb4b6209f90a808;hb=a201b000f7d777bd7b53748c3f13487fbb398599;hp=b13e05b8b4304b3b746cb8bd0cfc1472c5e6eb8f;hpb=6163f691593acf24d8aa0da8f4d621860f782e7d;p=netconf.git diff --git a/netconf/netconf-client/src/main/java/org/opendaylight/netconf/client/SimpleNetconfClientSessionListener.java b/netconf/netconf-client/src/main/java/org/opendaylight/netconf/client/SimpleNetconfClientSessionListener.java index b13e05b8b4..14b2bdf980 100644 --- a/netconf/netconf-client/src/main/java/org/opendaylight/netconf/client/SimpleNetconfClientSessionListener.java +++ b/netconf/netconf-client/src/main/java/org/opendaylight/netconf/client/SimpleNetconfClientSessionListener.java @@ -5,7 +5,6 @@ * 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.netconf.client; import com.google.common.base.Preconditions; @@ -14,7 +13,8 @@ import io.netty.util.concurrent.GlobalEventExecutor; import io.netty.util.concurrent.Promise; import java.util.ArrayDeque; import java.util.Queue; -import javax.annotation.concurrent.GuardedBy; +import org.checkerframework.checker.lock.qual.GuardedBy; +import org.checkerframework.checker.lock.qual.Holding; import org.opendaylight.netconf.api.NetconfMessage; import org.opendaylight.netconf.api.NetconfTerminationReason; import org.slf4j.Logger; @@ -25,7 +25,7 @@ public class SimpleNetconfClientSessionListener implements NetconfClientSessionL private final Promise promise; private final NetconfMessage request; - RequestEntry(Promise future, NetconfMessage request) { + RequestEntry(final Promise future, final NetconfMessage request) { this.promise = Preconditions.checkNotNull(future); this.request = Preconditions.checkNotNull(request); } @@ -39,7 +39,7 @@ public class SimpleNetconfClientSessionListener implements NetconfClientSessionL @GuardedBy("this") private NetconfClientSession clientSession; - @GuardedBy("this") + @Holding("this") private void dispatchRequest() { while (!requests.isEmpty()) { final RequestEntry e = requests.peek(); @@ -56,7 +56,7 @@ public class SimpleNetconfClientSessionListener implements NetconfClientSessionL @Override @SuppressWarnings("checkstyle:hiddenField") - public final synchronized void onSessionUp(NetconfClientSession clientSession) { + public final synchronized void onSessionUp(final NetconfClientSession clientSession) { this.clientSession = Preconditions.checkNotNull(clientSession); LOG.debug("Client session {} went up", clientSession); dispatchRequest(); @@ -73,22 +73,22 @@ public class SimpleNetconfClientSessionListener implements NetconfClientSessionL @Override @SuppressWarnings("checkstyle:hiddenField") - public final void onSessionDown(NetconfClientSession clientSession, Exception exception) { + public final void onSessionDown(final NetconfClientSession clientSession, final Exception exception) { LOG.debug("Client Session {} went down unexpectedly", clientSession, exception); tearDown(exception); } @Override @SuppressWarnings("checkstyle:hiddenField") - public final void onSessionTerminated(NetconfClientSession clientSession, - NetconfTerminationReason netconfTerminationReason) { + public final void onSessionTerminated(final NetconfClientSession clientSession, + final NetconfTerminationReason netconfTerminationReason) { LOG.debug("Client Session {} terminated, reason: {}", clientSession, netconfTerminationReason.getErrorMessage()); tearDown(new RuntimeException(netconfTerminationReason.getErrorMessage())); } @Override - public synchronized void onMessage(NetconfClientSession session, NetconfMessage message) { + public synchronized void onMessage(final NetconfClientSession session, final NetconfMessage message) { LOG.debug("New message arrived: {}", message); final RequestEntry e = requests.poll(); @@ -100,7 +100,7 @@ public class SimpleNetconfClientSessionListener implements NetconfClientSessionL } } - public final synchronized Future sendRequest(NetconfMessage message) { + public final synchronized Future sendRequest(final NetconfMessage message) { final RequestEntry req = new RequestEntry(GlobalEventExecutor.INSTANCE.newPromise(), message); requests.add(req);