mirror of https://github.com/grpc/grpc-java.git
Added utility class, ForwardingServerListener, that forwards calls to
underlying ServerCall.Listener. ------------- Created by MOE: http://code.google.com/p/moe-java MOE_MIGRATED_REVID=85910420
This commit is contained in:
parent
8aa79b39fc
commit
d2e35b0d02
|
|
@ -169,4 +169,36 @@ public class ServerInterceptors {
|
|||
return delegate.isCancelled();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Utility base class for decorating {@link ServerCall.Listener} instances.
|
||||
*/
|
||||
public static class ForwardingListener<RespT> extends ServerCall.Listener<RespT> {
|
||||
|
||||
private final ServerCall.Listener<RespT> delegate;
|
||||
|
||||
public ForwardingListener(ServerCall.Listener<RespT> delegate) {
|
||||
this.delegate = delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPayload(RespT payload) {
|
||||
delegate.onPayload(payload);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHalfClose() {
|
||||
delegate.onHalfClose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
delegate.onCancel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onComplete() {
|
||||
delegate.onComplete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue