Skip to content
Merged
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
28 changes: 4 additions & 24 deletions stub/src/main/java/io/grpc/stub/ServerCalls.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ private ServerCalls() {
*/
public static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncUnaryCall(
UnaryMethod<ReqT, RespT> method) {
return asyncUnaryRequestCall(method);
return new UnaryServerCallHandler<>(method);
}

/**
Expand All @@ -58,7 +58,7 @@ public static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncUnaryCall(
*/
public static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncServerStreamingCall(
ServerStreamingMethod<ReqT, RespT> method) {
return asyncUnaryRequestCall(method);
return new UnaryServerCallHandler<>(method);
}

/**
Expand All @@ -68,7 +68,7 @@ public static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncServerStreamingC
*/
public static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncClientStreamingCall(
ClientStreamingMethod<ReqT, RespT> method) {
return asyncStreamingRequestCall(method);
return new StreamingServerCallHandler<>(method);
}

/**
Expand All @@ -78,7 +78,7 @@ public static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncClientStreamingC
*/
public static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncBidiStreamingCall(
BidiStreamingMethod<ReqT, RespT> method) {
return asyncStreamingRequestCall(method);
return new StreamingServerCallHandler<>(method);
}

/**
Expand Down Expand Up @@ -205,16 +205,6 @@ public void onReady() {
}
}

/**
* Creates a {@link ServerCallHandler} for a unary request call method of the service.
*
* @param method an adaptor to the actual method on the service implementation.
*/
private static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncUnaryRequestCall(
UnaryRequestMethod<ReqT, RespT> method) {
return new UnaryServerCallHandler<>(method);
}

private static final class StreamingServerCallHandler<ReqT, RespT>
implements ServerCallHandler<ReqT, RespT> {

Expand Down Expand Up @@ -293,16 +283,6 @@ public void onReady() {
}
}

/**
* Creates a {@link ServerCallHandler} for a streaming request call method of the service.
*
* @param method an adaptor to the actual method on the service implementation.
*/
private static <ReqT, RespT> ServerCallHandler<ReqT, RespT> asyncStreamingRequestCall(
StreamingRequestMethod<ReqT, RespT> method) {
return new StreamingServerCallHandler<>(method);
}

private interface UnaryRequestMethod<ReqT, RespT> {
/**
* The provided {@code responseObserver} will extend {@link ServerCallStreamObserver}.
Expand Down