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

CLEANUP: tidy TCPMemcachedNodeImpl #880

Merged
merged 1 commit into from
Feb 20, 2025
Merged
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
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,12 @@ 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();
assert o == op;
getLogger().debug("Finished writing %s", op);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

μ•„λž˜μ™€ 같이 assert 문을 μΆ”κ°€ν•˜μ—¬ o와 op 객체가 동일함을 ν‘œν˜„ν•΄ μ£Όλ©΄ μ’‹κ² μŠ΅λ‹ˆλ‹€.

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

λ°˜μ˜ν–ˆμŠ΅λ‹ˆλ‹€.


preparePending();
if (shouldOptimize) {
Expand All @@ -288,12 +291,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
Loading