Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import java.time.Duration;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.Executor;
import javax.annotation.Nullable;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -22,4 +24,12 @@ public class GrpcPlatformServerDefinition {
@Builder.Default Duration maxConnectionAgeGrace = Duration.ZERO;
@Singular Collection<GrpcPlatformServiceFactory> serviceFactories;
@Singular List<ServerInterceptor> serverInterceptors;

/**
* Optional executor used by the gRPC server to run RPC handler callbacks. When {@code null} (the
* default), gRPC uses its built-in shared executor (an unbounded cached thread pool). Services
* that block inside their handlers can supply a bounded or virtual-thread executor here to
* control how handler work is dispatched.
*/
@Nullable Executor executor;
}
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ protected abstract GrpcServiceContainerEnvironment buildContainerEnvironment(
private ServerBuilder<?> initializeBuilder(GrpcPlatformServerDefinition serverDefinition) {
NettyServerBuilder builder = NettyServerBuilder.forPort(serverDefinition.getPort());

if (serverDefinition.getExecutor() != null) {
builder.executor(serverDefinition.getExecutor());
}
if (serverDefinition.getMaxInboundMessageSize() > 0) {
builder.maxInboundMessageSize(serverDefinition.getMaxInboundMessageSize());
}
Expand Down