Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Commit

Permalink
refactor: remove unused methods in replica session (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wu Tao authored Dec 8, 2020
1 parent d17b81a commit d427496
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

public class ReplicaSession {
public static class RequestEntry {
public int sequenceId;
int sequenceId;
public com.xiaomi.infra.pegasus.operator.client_operator op;
public Runnable callback;
public ScheduledFuture<?> timeoutTask;
Expand Down Expand Up @@ -84,24 +84,11 @@ public void initChannel(SocketChannel ch) {
this.firstRecentTimedOutMs = new AtomicLong(0);
}

// You can specify a message response filter with constructor or with "setMessageResponseFilter"
// function.
// the mainly usage of filter is test, in which you can control whether to abaondon a response
// and how to abandon it, so as to emulate some network failure cases
public ReplicaSession(
rpc_address address,
EventLoopGroup rpcGroup,
int socketTimeout,
MessageResponseFilter filter) {
this(address, rpcGroup, socketTimeout, (ReplicaSessionInterceptorManager) null);
this.filter = filter;
}

public void setMessageResponseFilter(MessageResponseFilter filter) {
void setMessageResponseFilter(MessageResponseFilter filter) {
this.filter = filter;
}

public int asyncSend(
public void asyncSend(
client_operator op,
Runnable callbackFunc,
long timeoutInMilliseconds,
Expand Down Expand Up @@ -135,7 +122,6 @@ public int asyncSend(
}
tryConnect();
}
return entry.sequenceId;
}

public void closeSession() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import org.apache.thrift.protocol.TBinaryProtocol;
import org.slf4j.Logger;

/** Created by [email protected] on 16-11-9. */
public class ThriftFrameEncoder extends MessageToByteEncoder<ReplicaSession.RequestEntry> {
private static final Logger logger = org.slf4j.LoggerFactory.getLogger(ThriftFrameEncoder.class);

Expand Down Expand Up @@ -60,12 +59,4 @@ protected void encode(ChannelHandlerContext ctx, ReplicaSession.RequestEntry e,
e.op.prepare_thrift_header(
meta_length, out.readableBytes() - ThriftHeader.HEADER_LENGTH - meta_length));
}

@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
logger.warn(
"got exception in outbound handler of {}, just ignore this: ",
ctx.channel().toString(),
cause);
}
}

0 comments on commit d427496

Please sign in to comment.