Added custom executor for grpc server with fixed 20 threads. Default thread pool is unbounded :(
This commit is contained in:
@@ -16,6 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package io.emeraldpay.dshackle
|
package io.emeraldpay.dshackle
|
||||||
|
|
||||||
|
import com.google.common.util.concurrent.ThreadFactoryBuilder
|
||||||
import io.emeraldpay.dshackle.config.MainConfig
|
import io.emeraldpay.dshackle.config.MainConfig
|
||||||
import io.emeraldpay.dshackle.monitoring.accesslog.AccessHandlerGrpc
|
import io.emeraldpay.dshackle.monitoring.accesslog.AccessHandlerGrpc
|
||||||
import io.grpc.Server
|
import io.grpc.Server
|
||||||
@@ -24,6 +25,7 @@ import org.slf4j.LoggerFactory
|
|||||||
import org.springframework.beans.factory.annotation.Autowired
|
import org.springframework.beans.factory.annotation.Autowired
|
||||||
import org.springframework.stereotype.Service
|
import org.springframework.stereotype.Service
|
||||||
import java.net.InetSocketAddress
|
import java.net.InetSocketAddress
|
||||||
|
import java.util.concurrent.Executors
|
||||||
import javax.annotation.PostConstruct
|
import javax.annotation.PostConstruct
|
||||||
import javax.annotation.PreDestroy
|
import javax.annotation.PreDestroy
|
||||||
|
|
||||||
@@ -63,6 +65,13 @@ open class GrpcServer(
|
|||||||
serverBuilder.addService(it)
|
serverBuilder.addService(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
serverBuilder.executor(
|
||||||
|
Executors.newFixedThreadPool(
|
||||||
|
20,
|
||||||
|
ThreadFactoryBuilder().setNameFormat("custom-grpc-%d").build()
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
val server = serverBuilder.build()
|
val server = serverBuilder.build()
|
||||||
this.server = server
|
this.server = server
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user