[Q] How to use custom ThreadPool's and WorkQueue for GRPCServers?
See original GitHub issueWe can achieve this by using the GrpcEnvironment class
here but as we know that Grpc.Core
lib got Deprecated so the only way to create GRPCServer is via native ASP.Core gRPCServer’s but I need some suggestions on creating Server with custom threadpools like in JAVA.
Java’s gRPC Server class with Executor
.
public abstract class ServerBuilder<T extends ServerBuilder<T>> {
public ServerBuilder() {
}
public static ServerBuilder<?> forPort(int port) {
return ServerProvider.provider().builderForPort(port);
}
public abstract T directExecutor();
public abstract T executor(@Nullable Executor var1);
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/8274")
public T callExecutor(ServerCallExecutorSupplier executorSupplier) {
return this.thisT();
}
public abstract T addService(ServerServiceDefinition var1);
public abstract T addService(BindableService var1);
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/7925")
public final T addServices(List<ServerServiceDefinition> services) {
Preconditions.checkNotNull(services, "services");
Iterator var2 = services.iterator();
while(var2.hasNext()) {
ServerServiceDefinition service = (ServerServiceDefinition)var2.next();
this.addService(service);
}
return this.thisT();
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/3117")
public T intercept(ServerInterceptor interceptor) {
throw new UnsupportedOperationException();
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2132")
public T addTransportFilter(ServerTransportFilter filter) {
throw new UnsupportedOperationException();
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/2861")
public T addStreamTracerFactory(ServerStreamTracer.Factory factory) {
throw new UnsupportedOperationException();
}
public abstract T fallbackHandlerRegistry(@Nullable HandlerRegistry var1);
public abstract T useTransportSecurity(File var1, File var2);
public T useTransportSecurity(InputStream certChain, InputStream privateKey) {
throw new UnsupportedOperationException();
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
public abstract T decompressorRegistry(@Nullable DecompressorRegistry var1);
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/1704")
public abstract T compressorRegistry(@Nullable CompressorRegistry var1);
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/3706")
public T handshakeTimeout(long timeout, TimeUnit unit) {
throw new UnsupportedOperationException();
}
public T maxInboundMessageSize(int bytes) {
Preconditions.checkArgument(bytes >= 0, "bytes must be >= 0");
return this.thisT();
}
public T maxInboundMetadataSize(int bytes) {
Preconditions.checkArgument(bytes > 0, "maxInboundMetadataSize must be > 0");
return this.thisT();
}
@ExperimentalApi("https://github.com/grpc/grpc-java/issues/4017")
public T setBinaryLog(BinaryLog binaryLog) {
throw new UnsupportedOperationException();
}
public abstract Server build();
private T thisT() {
return this;
}
}
Thanks in advance!
Issue Analytics
- State:
- Created 6 months ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
python - How to do client side load-balancing with custom ...
This question is slightly different. How can I pass executor to grpc.insecure_channel? gRPC client doesn't accept executor as an input.
Read more >Java Development Practices: Using Thread Pools and ...
You can create a thread pool by using new ThreadPoolExecutor(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue, threadFactory ...
Read more >Threading Model - Apache Camel
Contents. Thread pool profiles; Configuring default thread pool profile; Using thread pool profiles; Creating custom thread pools; Customizing thread names ...
Read more >ThreadPoolExecutor - Java Thread Pool Example
We can use ThreadPoolExecutor to create thread pool in Java. ... Here is our custom implementation of RejectedExecutionHandler interface.
Read more >ThreadPool.QueueUserWorkItem Method
Queues a method for execution. The method executes when a thread pool thread becomes available.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
There is no thread pool, queuing, or execution logic in Grpc.AspNetCore. It exists in ASP.NET Core which Grpc.AspNetCore runs on top of.
This is not appropriate for Grpc.AspNetCore.
@JamesNK, Let me explain my uses case: