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

Constant names should comply with a naming convention #43

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
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public class DefaultConnectionFactory extends SpyObject implements
* Default failure mode.
*/
public static final FailureMode DEFAULT_FAILURE_MODE =
FailureMode.Redistribute;
FailureMode.REDISTRIBUTE;

/**
* Default hash algorithm.
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/spy/memcached/FailureMode.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public enum FailureMode {
* given key.
* </p>
*/
Redistribute,
REDISTRIBUTE,
/**
* Continue to retry a failing node until it comes back up.
*
Expand All @@ -46,10 +46,10 @@ public enum FailureMode {
* wait very long for async command completion.
* </p>
*/
Retry,
RETRY,

/**
* Automatically cancel all operations heading towards a downed node.
*/
Cancel
CANCEL
}
72 changes: 36 additions & 36 deletions src/main/java/net/spy/memcached/MemcachedClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ public OperationFuture<Boolean> append(String key, Object val) {
@Override
public <T> OperationFuture<Boolean> append(long cas, String key, T val,
Transcoder<T> tc) {
return asyncCat(ConcatenationType.append, cas, key, val, tc);
return asyncCat(ConcatenationType.APPEND, cas, key, val, tc);
}

/**
Expand All @@ -498,7 +498,7 @@ public <T> OperationFuture<Boolean> append(long cas, String key, T val,
@Override
public <T> OperationFuture<Boolean> append(String key, T val,
Transcoder<T> tc) {
return asyncCat(ConcatenationType.append, 0, key, val, tc);
return asyncCat(ConcatenationType.APPEND, 0, key, val, tc);
}

/**
Expand Down Expand Up @@ -563,7 +563,7 @@ public OperationFuture<Boolean> prepend(String key, Object val) {
@Override
public <T> OperationFuture<Boolean> prepend(long cas, String key, T val,
Transcoder<T> tc) {
return asyncCat(ConcatenationType.prepend, cas, key, val, tc);
return asyncCat(ConcatenationType.PREPEND, cas, key, val, tc);
}

/**
Expand All @@ -584,7 +584,7 @@ public <T> OperationFuture<Boolean> prepend(long cas, String key, T val,
@Override
public <T> OperationFuture<Boolean> prepend(String key, T val,
Transcoder<T> tc) {
return asyncCat(ConcatenationType.prepend, 0, key, val, tc);
return asyncCat(ConcatenationType.PREPEND, 0, key, val, tc);
}

/**
Expand Down Expand Up @@ -626,7 +626,7 @@ public <T> OperationFuture<Boolean> prepend(String key, T val,
final OperationFuture<CASResponse> rv =
new OperationFuture<CASResponse>(key, latch, operationTimeout,
executorService);
Operation op = opFact.cas(StoreType.set, key, casId, co.getFlags(), exp,
Operation op = opFact.cas(StoreType.SET, key, casId, co.getFlags(), exp,
co.getData(), new StoreOperation.Callback() {
@Override
public void receivedStatus(OperationStatus val) {
Expand Down Expand Up @@ -816,7 +816,7 @@ public CASResponse cas(String key, long casId, int exp, Object value) {
@Override
public <T> OperationFuture<Boolean> add(String key, int exp, T o,
Transcoder<T> tc) {
return asyncStore(StoreType.add, key, exp, o, tc);
return asyncStore(StoreType.ADD, key, exp, o, tc);
}

/**
Expand Down Expand Up @@ -852,7 +852,7 @@ public <T> OperationFuture<Boolean> add(String key, int exp, T o,
*/
@Override
public OperationFuture<Boolean> add(String key, int exp, Object o) {
return asyncStore(StoreType.add, key, exp, o, transcoder);
return asyncStore(StoreType.ADD, key, exp, o, transcoder);
}

/**
Expand Down Expand Up @@ -890,7 +890,7 @@ public OperationFuture<Boolean> add(String key, int exp, Object o) {
@Override
public <T> OperationFuture<Boolean> set(String key, int exp, T o,
Transcoder<T> tc) {
return asyncStore(StoreType.set, key, exp, o, tc);
return asyncStore(StoreType.SET, key, exp, o, tc);
}

/**
Expand Down Expand Up @@ -926,7 +926,7 @@ public <T> OperationFuture<Boolean> set(String key, int exp, T o,
*/
@Override
public OperationFuture<Boolean> set(String key, int exp, Object o) {
return asyncStore(StoreType.set, key, exp, o, transcoder);
return asyncStore(StoreType.SET, key, exp, o, transcoder);
}

/**
Expand Down Expand Up @@ -965,7 +965,7 @@ public OperationFuture<Boolean> set(String key, int exp, Object o) {
@Override
public <T> OperationFuture<Boolean> replace(String key, int exp, T o,
Transcoder<T> tc) {
return asyncStore(StoreType.replace, key, exp, o, tc);
return asyncStore(StoreType.REPLACE, key, exp, o, tc);
}

/**
Expand Down Expand Up @@ -1001,7 +1001,7 @@ public <T> OperationFuture<Boolean> replace(String key, int exp, T o,
*/
@Override
public OperationFuture<Boolean> replace(String key, int exp, Object o) {
return asyncStore(StoreType.replace, key, exp, o, transcoder);
return asyncStore(StoreType.REPLACE, key, exp, o, transcoder);
}

/**
Expand Down Expand Up @@ -1795,7 +1795,7 @@ public void complete() {
*/
@Override
public long incr(String key, long by) {
return mutate(Mutator.incr, key, by, 0, -1);
return mutate(Mutator.INCR, key, by, 0, -1);
}

/**
Expand All @@ -1815,7 +1815,7 @@ public long incr(String key, long by) {
*/
@Override
public long incr(String key, int by) {
return mutate(Mutator.incr, key, by, 0, -1);
return mutate(Mutator.INCR, key, by, 0, -1);
}

/**
Expand All @@ -1835,7 +1835,7 @@ public long incr(String key, int by) {
*/
@Override
public long decr(String key, long by) {
return mutate(Mutator.decr, key, by, 0, -1);
return mutate(Mutator.DECR, key, by, 0, -1);
}

/**
Expand All @@ -1855,7 +1855,7 @@ public long decr(String key, long by) {
*/
@Override
public long decr(String key, int by) {
return mutate(Mutator.decr, key, by, 0, -1);
return mutate(Mutator.DECR, key, by, 0, -1);
}

/**
Expand All @@ -1877,7 +1877,7 @@ public long decr(String key, int by) {
*/
@Override
public long incr(String key, long by, long def, int exp) {
return mutateWithDefault(Mutator.incr, key, by, def, exp);
return mutateWithDefault(Mutator.INCR, key, by, def, exp);
}

/**
Expand All @@ -1899,7 +1899,7 @@ public long incr(String key, long by, long def, int exp) {
*/
@Override
public long incr(String key, int by, long def, int exp) {
return mutateWithDefault(Mutator.incr, key, by, def, exp);
return mutateWithDefault(Mutator.INCR, key, by, def, exp);
}

/**
Expand All @@ -1921,7 +1921,7 @@ public long incr(String key, int by, long def, int exp) {
*/
@Override
public long decr(String key, long by, long def, int exp) {
return mutateWithDefault(Mutator.decr, key, by, def, exp);
return mutateWithDefault(Mutator.DECR, key, by, def, exp);
}

/**
Expand All @@ -1943,7 +1943,7 @@ public long decr(String key, long by, long def, int exp) {
*/
@Override
public long decr(String key, int by, long def, int exp) {
return mutateWithDefault(Mutator.decr, key, by, def, exp);
return mutateWithDefault(Mutator.DECR, key, by, def, exp);
}

private long mutateWithDefault(Mutator t, String key, long by, long def,
Expand All @@ -1952,7 +1952,7 @@ private long mutateWithDefault(Mutator t, String key, long by, long def,
// The ascii protocol doesn't support defaults, so I added them
// manually here.
if (rv == -1) {
Future<Boolean> f = asyncStore(StoreType.add, key, exp,
Future<Boolean> f = asyncStore(StoreType.ADD, key, exp,
String.valueOf(def));
try {
if (f.get(operationTimeout, TimeUnit.MILLISECONDS)) {
Expand Down Expand Up @@ -2018,7 +2018,7 @@ public void complete() {
*/
@Override
public OperationFuture<Long> asyncIncr(String key, long by) {
return asyncMutate(Mutator.incr, key, by, 0, -1);
return asyncMutate(Mutator.INCR, key, by, 0, -1);
}

/**
Expand All @@ -2032,7 +2032,7 @@ public OperationFuture<Long> asyncIncr(String key, long by) {
*/
@Override
public OperationFuture<Long> asyncIncr(String key, int by) {
return asyncMutate(Mutator.incr, key, by, 0, -1);
return asyncMutate(Mutator.INCR, key, by, 0, -1);
}

/**
Expand All @@ -2046,7 +2046,7 @@ public OperationFuture<Long> asyncIncr(String key, int by) {
*/
@Override
public OperationFuture<Long> asyncDecr(String key, long by) {
return asyncMutate(Mutator.decr, key, by, 0, -1);
return asyncMutate(Mutator.DECR, key, by, 0, -1);
}

/**
Expand All @@ -2060,7 +2060,7 @@ public OperationFuture<Long> asyncDecr(String key, long by) {
*/
@Override
public OperationFuture<Long> asyncDecr(String key, int by) {
return asyncMutate(Mutator.decr, key, by, 0, -1);
return asyncMutate(Mutator.DECR, key, by, 0, -1);
}

/**
Expand All @@ -2077,7 +2077,7 @@ public OperationFuture<Long> asyncDecr(String key, int by) {
@Override
public OperationFuture<Long> asyncIncr(String key, long by, long def,
int exp) {
return asyncMutate(Mutator.incr, key, by, def, exp);
return asyncMutate(Mutator.INCR, key, by, def, exp);
}

/**
Expand All @@ -2094,7 +2094,7 @@ public OperationFuture<Long> asyncIncr(String key, long by, long def,
@Override
public OperationFuture<Long> asyncIncr(String key, int by, long def,
int exp) {
return asyncMutate(Mutator.incr, key, by, def, exp);
return asyncMutate(Mutator.INCR, key, by, def, exp);
}

/**
Expand All @@ -2111,7 +2111,7 @@ public OperationFuture<Long> asyncIncr(String key, int by, long def,
@Override
public OperationFuture<Long> asyncDecr(String key, long by, long def,
int exp) {
return asyncMutate(Mutator.decr, key, by, def, exp);
return asyncMutate(Mutator.DECR, key, by, def, exp);
}

/**
Expand All @@ -2128,7 +2128,7 @@ public OperationFuture<Long> asyncDecr(String key, long by, long def,
@Override
public OperationFuture<Long> asyncDecr(String key, int by, long def,
int exp) {
return asyncMutate(Mutator.decr, key, by, def, exp);
return asyncMutate(Mutator.DECR, key, by, def, exp);
}

/**
Expand All @@ -2143,7 +2143,7 @@ public OperationFuture<Long> asyncDecr(String key, int by, long def,
*/
@Override
public OperationFuture<Long> asyncIncr(String key, long by, long def) {
return asyncMutate(Mutator.incr, key, by, def, 0);
return asyncMutate(Mutator.INCR, key, by, def, 0);
}

/**
Expand All @@ -2158,7 +2158,7 @@ public OperationFuture<Long> asyncIncr(String key, long by, long def) {
*/
@Override
public OperationFuture<Long> asyncIncr(String key, int by, long def) {
return asyncMutate(Mutator.incr, key, by, def, 0);
return asyncMutate(Mutator.INCR, key, by, def, 0);
}

/**
Expand All @@ -2173,7 +2173,7 @@ public OperationFuture<Long> asyncIncr(String key, int by, long def) {
*/
@Override
public OperationFuture<Long> asyncDecr(String key, long by, long def) {
return asyncMutate(Mutator.decr, key, by, def, 0);
return asyncMutate(Mutator.DECR, key, by, def, 0);
}

/**
Expand All @@ -2188,7 +2188,7 @@ public OperationFuture<Long> asyncDecr(String key, long by, long def) {
*/
@Override
public OperationFuture<Long> asyncDecr(String key, int by, long def) {
return asyncMutate(Mutator.decr, key, by, def, 0);
return asyncMutate(Mutator.DECR, key, by, def, 0);
}

/**
Expand All @@ -2205,7 +2205,7 @@ public OperationFuture<Long> asyncDecr(String key, int by, long def) {
*/
@Override
public long incr(String key, long by, long def) {
return mutateWithDefault(Mutator.incr, key, by, def, 0);
return mutateWithDefault(Mutator.INCR, key, by, def, 0);
}

/**
Expand All @@ -2222,7 +2222,7 @@ public long incr(String key, long by, long def) {
*/
@Override
public long incr(String key, int by, long def) {
return mutateWithDefault(Mutator.incr, key, by, def, 0);
return mutateWithDefault(Mutator.INCR, key, by, def, 0);
}

/**
Expand All @@ -2239,7 +2239,7 @@ public long incr(String key, int by, long def) {
*/
@Override
public long decr(String key, long by, long def) {
return mutateWithDefault(Mutator.decr, key, by, def, 0);
return mutateWithDefault(Mutator.DECR, key, by, def, 0);
}

/**
Expand All @@ -2256,7 +2256,7 @@ public long decr(String key, long by, long def) {
*/
@Override
public long decr(String key, int by, long def) {
return mutateWithDefault(Mutator.decr, key, by, def, 0);
return mutateWithDefault(Mutator.DECR, key, by, def, 0);
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/net/spy/memcached/MemcachedConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -987,9 +987,9 @@ protected void queueReconnect(final MemcachedNode node) {
metrics.incrementCounter(RECON_QUEUE_METRIC);

node.setupResend();
if (failureMode == FailureMode.Redistribute) {
if (failureMode == FailureMode.REDISTRIBUTE) {
redistributeOperations(node.destroyInputQueue());
} else if (failureMode == FailureMode.Cancel) {
} else if (failureMode == FailureMode.CANCEL) {
cancelOperations(node.destroyInputQueue());
}
}
Expand Down Expand Up @@ -1204,9 +1204,9 @@ protected void addOperation(final String key, final Operation o) {
MemcachedNode placeIn = null;
MemcachedNode primary = locator.getPrimary(key);

if (primary.isActive() || failureMode == FailureMode.Retry) {
if (primary.isActive() || failureMode == FailureMode.RETRY) {
placeIn = primary;
} else if (failureMode == FailureMode.Cancel) {
} else if (failureMode == FailureMode.CANCEL) {
o.cancel();
} else {
Iterator<MemcachedNode> i = locator.getSequence(key);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/net/spy/memcached/ops/ConcatenationType.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ public enum ConcatenationType {
/**
* Concatenate supplied data to the end of the existing data.
*/
append,
APPEND,
/**
* Concatenate existing data onto the end of the supplied data.
*/
prepend
PREPEND
}
Loading