Merge pull request #52 from p2p-org/custom-executor-for-grpc

Added custom executor for grpc
This commit is contained in:
Vyacheslav Shebanov
2022-12-01 18:16:29 +02:00
committed by GitHub

View File

@@ -16,6 +16,7 @@
*/
package io.emeraldpay.dshackle
import com.google.common.util.concurrent.ThreadFactoryBuilder
import io.emeraldpay.dshackle.config.MainConfig
import io.emeraldpay.dshackle.monitoring.accesslog.AccessHandlerGrpc
import io.grpc.Server
@@ -24,6 +25,7 @@ import org.slf4j.LoggerFactory
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Service
import java.net.InetSocketAddress
import java.util.concurrent.Executors
import javax.annotation.PostConstruct
import javax.annotation.PreDestroy
@@ -63,6 +65,13 @@ open class GrpcServer(
serverBuilder.addService(it)
}
serverBuilder.executor(
Executors.newFixedThreadPool(
20,
ThreadFactoryBuilder().setNameFormat("custom-grpc-%d").build()
)
)
val server = serverBuilder.build()
this.server = server