Search in sources :

Example 1 with GrpcServerConfigurer

use of net.devh.boot.grpc.server.serverfactory.GrpcServerConfigurer in project hedera-mirror-node by hashgraph.

the class GrpcConfiguration method grpcServerConfigurer.

@Bean
GrpcServerConfigurer grpcServerConfigurer(GrpcProperties grpcProperties) {
    NettyProperties nettyProperties = grpcProperties.getNetty();
    Executor executor = new ThreadPoolExecutor(nettyProperties.getExecutorCoreThreadCount(), nettyProperties.getExecutorMaxThreadCount(), nettyProperties.getThreadKeepAliveTime().toSeconds(), TimeUnit.SECONDS, new SynchronousQueue<>(), new ThreadFactoryBuilder().setDaemon(true).setNameFormat("grpc-executor-%d").build());
    return serverBuilder -> ((NettyServerBuilder) serverBuilder).executor(executor).maxConnectionIdle(nettyProperties.getMaxConnectionIdle().toSeconds(), TimeUnit.SECONDS).maxConcurrentCallsPerConnection(nettyProperties.getMaxConcurrentCallsPerConnection()).maxInboundMessageSize(nettyProperties.getMaxInboundMessageSize()).maxInboundMetadataSize(nettyProperties.getMaxInboundMetadataSize());
}
Also used : ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) NettyServerBuilder(io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder) Executor(java.util.concurrent.Executor) SynchronousQueue(java.util.concurrent.SynchronousQueue) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) EntityScan(org.springframework.boot.autoconfigure.domain.EntityScan) GrpcProperties(com.hedera.mirror.grpc.GrpcProperties) HealthIndicator(org.springframework.boot.actuate.health.HealthIndicator) GrpcServerConfigurer(net.devh.boot.grpc.server.serverfactory.GrpcServerConfigurer) LinkedHashMap(java.util.LinkedHashMap) TimeUnit(java.util.concurrent.TimeUnit) GrpcServiceDefinition(net.devh.boot.grpc.server.service.GrpcServiceDefinition) Configuration(org.springframework.context.annotation.Configuration) CompositeHealthContributor(org.springframework.boot.actuate.health.CompositeHealthContributor) GrpcServiceDiscoverer(net.devh.boot.grpc.server.service.GrpcServiceDiscoverer) Map(java.util.Map) Bean(org.springframework.context.annotation.Bean) HealthStatusManager(io.grpc.services.HealthStatusManager) Executor(java.util.concurrent.Executor) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) NettyServerBuilder(io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder) ThreadFactoryBuilder(com.google.common.util.concurrent.ThreadFactoryBuilder) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) Bean(org.springframework.context.annotation.Bean)

Aggregations

ThreadFactoryBuilder (com.google.common.util.concurrent.ThreadFactoryBuilder)1 GrpcProperties (com.hedera.mirror.grpc.GrpcProperties)1 NettyServerBuilder (io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder)1 HealthStatusManager (io.grpc.services.HealthStatusManager)1 LinkedHashMap (java.util.LinkedHashMap)1 Map (java.util.Map)1 Executor (java.util.concurrent.Executor)1 SynchronousQueue (java.util.concurrent.SynchronousQueue)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 TimeUnit (java.util.concurrent.TimeUnit)1 GrpcServerConfigurer (net.devh.boot.grpc.server.serverfactory.GrpcServerConfigurer)1 GrpcServiceDefinition (net.devh.boot.grpc.server.service.GrpcServiceDefinition)1 GrpcServiceDiscoverer (net.devh.boot.grpc.server.service.GrpcServiceDiscoverer)1 CompositeHealthContributor (org.springframework.boot.actuate.health.CompositeHealthContributor)1 HealthIndicator (org.springframework.boot.actuate.health.HealthIndicator)1 EntityScan (org.springframework.boot.autoconfigure.domain.EntityScan)1 Bean (org.springframework.context.annotation.Bean)1 Configuration (org.springframework.context.annotation.Configuration)1