From c7a32f783dda6274963672fef6f82c4dc3acf45a Mon Sep 17 00:00:00 2001 From: Zeeshan Asghar Date: Mon, 18 Jan 2016 15:08:22 +0500 Subject: [PATCH] squid:S2786 Nested enum should not be declared static squid:MissingDeprecatedCheck Deprecated elements should have both the annotation and the Javadoc tag squid:S1845 Methods and field names should not be the same or differ only by capitalization squid:S1170 Public constants and fields initialized at declaration should be static final rather than merely final --- .../net/spy/memcached/ConnectionFactoryBuilder.java | 4 ++-- .../net/spy/memcached/internal/OperationFuture.java | 1 + .../net/spy/memcached/protocol/BaseOperationImpl.java | 6 +++--- .../memcached/protocol/ascii/StatsOperationImpl.java | 10 +++++----- .../util/DefaultKetamaNodeLocatorConfiguration.java | 2 +- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main/java/net/spy/memcached/ConnectionFactoryBuilder.java b/src/main/java/net/spy/memcached/ConnectionFactoryBuilder.java index e7c74209d..f79fff4bb 100644 --- a/src/main/java/net/spy/memcached/ConnectionFactoryBuilder.java +++ b/src/main/java/net/spy/memcached/ConnectionFactoryBuilder.java @@ -457,7 +457,7 @@ public long getAuthWaitTime() { /** * Type of protocol to use for connections. */ - public static enum Protocol { + public enum Protocol { /** * Use the text (ascii) protocol. */ @@ -471,7 +471,7 @@ public static enum Protocol { /** * Type of node locator to use. */ - public static enum Locator { + public enum Locator { /** * Array modulus - the classic node location algorithm. */ diff --git a/src/main/java/net/spy/memcached/internal/OperationFuture.java b/src/main/java/net/spy/memcached/internal/OperationFuture.java index ffc20f75a..3e7c6c644 100644 --- a/src/main/java/net/spy/memcached/internal/OperationFuture.java +++ b/src/main/java/net/spy/memcached/internal/OperationFuture.java @@ -106,6 +106,7 @@ public OperationFuture(String k, CountDownLatch l, AtomicReference oref, * @deprecated * @return true if the operation has not yet been written to the network */ + @Deprecated public boolean cancel(boolean ign) { assert op != null : "No operation"; op.cancel(); diff --git a/src/main/java/net/spy/memcached/protocol/BaseOperationImpl.java b/src/main/java/net/spy/memcached/protocol/BaseOperationImpl.java index 24d690899..e7dd7b219 100644 --- a/src/main/java/net/spy/memcached/protocol/BaseOperationImpl.java +++ b/src/main/java/net/spy/memcached/protocol/BaseOperationImpl.java @@ -59,7 +59,7 @@ public abstract class BaseOperationImpl extends SpyObject implements Operation { new TimedOutOperationStatus(); private volatile OperationState state = OperationState.WRITE_QUEUED; private ByteBuffer cmd = null; - private boolean cancelled = false; + private boolean isCancelled = false; private OperationException exception = null; protected OperationCallback callback = null; private volatile MemcachedNode handlingNode = null; @@ -102,7 +102,7 @@ protected void setCallback(OperationCallback to) { } public final synchronized boolean isCancelled() { - return cancelled; + return isCancelled; } public final boolean hasErrored() { @@ -114,7 +114,7 @@ public final OperationException getException() { } public final synchronized void cancel() { - cancelled = true; + isCancelled = true; synchronized (clones) { Iterator i = clones.iterator(); diff --git a/src/main/java/net/spy/memcached/protocol/ascii/StatsOperationImpl.java b/src/main/java/net/spy/memcached/protocol/ascii/StatsOperationImpl.java index e338da588..32d0c1a61 100644 --- a/src/main/java/net/spy/memcached/protocol/ascii/StatsOperationImpl.java +++ b/src/main/java/net/spy/memcached/protocol/ascii/StatsOperationImpl.java @@ -40,16 +40,16 @@ final class StatsOperationImpl extends OperationImpl implements StatsOperation { private static final byte[] MSG = "stats\r\n".getBytes(); - private final byte[] msg; + private final byte[] msgBytes; private final StatsOperation.Callback cb; public StatsOperationImpl(String arg, StatsOperation.Callback c) { super(c); cb = c; if (arg == null) { - msg = MSG; + msgBytes = MSG; } else { - msg = ("stats " + arg + "\r\n").getBytes(); + msgBytes = ("stats " + arg + "\r\n").getBytes(); } } @@ -67,7 +67,7 @@ public void handleLine(String line) { @Override public void initialize() { - setBuffer(ByteBuffer.wrap(msg)); + setBuffer(ByteBuffer.wrap(msgBytes)); } @Override @@ -77,6 +77,6 @@ protected void wasCancelled() { @Override public String toString() { - return "Cmd: " + Arrays.toString(msg); + return "Cmd: " + Arrays.toString(msgBytes); } } diff --git a/src/main/java/net/spy/memcached/util/DefaultKetamaNodeLocatorConfiguration.java b/src/main/java/net/spy/memcached/util/DefaultKetamaNodeLocatorConfiguration.java index 521fa7e97..cdb4986f9 100644 --- a/src/main/java/net/spy/memcached/util/DefaultKetamaNodeLocatorConfiguration.java +++ b/src/main/java/net/spy/memcached/util/DefaultKetamaNodeLocatorConfiguration.java @@ -35,7 +35,7 @@ public class DefaultKetamaNodeLocatorConfiguration implements KetamaNodeLocatorConfiguration { - private final int numReps = 160; + private static final int numReps = 160; // Internal lookup map to try to carry forward the optimisation that was // previously in KetamaNodeLocator