Skip to content

Commit

Permalink
CLEANUP: tidy TCPMemcachedNodeImpl
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviarla committed Feb 20, 2025
1 parent fb0501c commit 0c02634
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 22 deletions.
5 changes: 0 additions & 5 deletions src/main/java/net/spy/memcached/MemcachedNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,6 @@ public interface MemcachedNode {
*/
void fillWriteBuffer(boolean optimizeGets);

/**
* Transition the current write item into a read state.
*/
void transitionWriteItem();

/**
* Get the operation at the top of the queue that is requiring input.
*/
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/net/spy/memcached/MemcachedNodeROImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,6 @@ public void setupResend(String cause) {
throw new UnsupportedOperationException();
}

public void transitionWriteItem() {
throw new UnsupportedOperationException();
}

public int writeSome() throws IOException {
throw new UnsupportedOperationException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public abstract class TCPMemcachedNodeImpl extends SpyObject
private final AtomicLong timeoutStartNanos = new AtomicLong(0);
private boolean toRatioEnabled = false;
private int[] toCountArray;
private final static int MAX_TOCOUNT = 100; /* to count array size */
private static final int MAX_TOCOUNT = 100; /* to count array size */
private int toCountIdx; /* to count array index */
private int toRatioMax; /* maximum timeout ratio */
private int toRatioNow; /* current timeout ratio */
Expand Down Expand Up @@ -260,9 +260,11 @@ public final void fillWriteBuffer(boolean shouldOptimize) {
getWbuf().put(b);
getLogger().debug("After copying stuff from %s: %s",
o, getWbuf());
if (!o.getBuffer().hasRemaining()) {
if (!obuf.hasRemaining()) {
o.writeComplete();
transitionWriteItem();

Operation op = removeCurrentWriteOp();
getLogger().debug("Finished writing %s", op);

preparePending();
if (shouldOptimize) {
Expand All @@ -288,12 +290,6 @@ public final void fillWriteBuffer(boolean shouldOptimize) {
}
}

public final void transitionWriteItem() {
Operation op = removeCurrentWriteOp();
assert op != null : "There is no write item to transition";
getLogger().debug("Finished writing %s", op);
}

protected abstract void optimize();

public final Operation getCurrentReadOp() {
Expand Down
4 changes: 0 additions & 4 deletions src/test/java/net/spy/memcached/MockMemcachedNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ public void fillWriteBuffer(boolean optimizeGets) {
// noop
}

public void transitionWriteItem() {
// noop
}

public Operation getCurrentReadOp() {
return null;
}
Expand Down

0 comments on commit 0c02634

Please sign in to comment.