Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code Improvments: remove enum static, rename fields and methods, create final static #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/java/net/spy/memcached/ConnectionFactoryBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -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.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public OperationFuture(String k, CountDownLatch l, AtomicReference<T> 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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -102,7 +102,7 @@ protected void setCallback(OperationCallback to) {
}

public final synchronized boolean isCancelled() {
return cancelled;
return isCancelled;
}

public final boolean hasErrored() {
Expand All @@ -114,7 +114,7 @@ public final OperationException getException() {
}

public final synchronized void cancel() {
cancelled = true;
isCancelled = true;

synchronized (clones) {
Iterator<Operation> i = clones.iterator();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand All @@ -67,7 +67,7 @@ public void handleLine(String line) {

@Override
public void initialize() {
setBuffer(ByteBuffer.wrap(msg));
setBuffer(ByteBuffer.wrap(msgBytes));
}

@Override
Expand All @@ -77,6 +77,6 @@ protected void wasCancelled() {

@Override
public String toString() {
return "Cmd: " + Arrays.toString(msg);
return "Cmd: " + Arrays.toString(msgBytes);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down