use of org.neo4j.bolt.transport.BoltMemoryPool in project neo4j by neo4j.
the class BoltServer method init.
@Override
public void init() {
Log log = logService.getInternalLog(BoltServer.class);
boltMemoryPool = new BoltMemoryPool(memoryPools, NETTY_BUF_ALLOCATOR.metric());
life.add(new BoltMemoryPoolLifeCycleAdapter(boltMemoryPool));
InternalLoggerFactory.setDefaultFactory(new Netty4LoggerFactory(logService.getInternalLogProvider()));
TransportThrottleGroup throttleGroup = new TransportThrottleGroup(config, clock);
BoltSchedulerProvider boltSchedulerProvider = life.setLast(new ExecutorBoltSchedulerProvider(config, new CachedThreadPoolExecutorFactory(), jobScheduler, logService));
BoltConnectionFactory boltConnectionFactory = createConnectionFactory(config, boltSchedulerProvider, logService, clock);
BoltStateMachineFactory externalBoltStateMachineFactory = createBoltStateMachineFactory(createAuthentication(externalAuthManager), clock);
BoltStateMachineFactory internalBoltStateMachineFactory = createBoltStateMachineFactory(createAuthentication(internalAuthManager), clock);
BoltStateMachineFactory loopbackBoltStateMachineFactory = createBoltStateMachineFactory(createAuthentication(loopbackAuthManager), clock);
BoltProtocolFactory externalBoltProtocolFactory = createBoltProtocolFactory(boltConnectionFactory, externalBoltStateMachineFactory, throttleGroup, clock, config.get(BoltConnectorInternalSettings.connection_keep_alive));
BoltProtocolFactory internalBoltProtocolFactory = createBoltProtocolFactory(boltConnectionFactory, internalBoltStateMachineFactory, throttleGroup, clock, config.get(BoltConnectorInternalSettings.connection_keep_alive));
BoltProtocolFactory loopbackBoltProtocolFactory = createBoltProtocolFactory(boltConnectionFactory, loopbackBoltStateMachineFactory, throttleGroup, clock, config.get(BoltConnectorInternalSettings.connection_keep_alive));
if (config.get(CommonConnectorConfig.ocsp_stapling_enabled)) {
enableOcspStapling();
}
ByteBufAllocator bufferAllocator = getBufferAllocator();
if (config.get(BoltConnector.enabled)) {
jobScheduler.setThreadFactory(Group.BOLT_NETWORK_IO, NettyThreadFactory::new);
NettyServer nettyServer;
var isNotReadReplica = config.get(GraphDatabaseSettings.mode) != GraphDatabaseSettings.Mode.READ_REPLICA;
var loopbackProtocolInitializer = createLoopbackProtocolInitializer(loopbackBoltProtocolFactory, throttleGroup, bufferAllocator);
if (config.get(GraphDatabaseSettings.routing_enabled) && isNotReadReplica) {
nettyServer = new NettyServer(jobScheduler.threadFactory(Group.BOLT_NETWORK_IO), createExternalProtocolInitializer(externalBoltProtocolFactory, throttleGroup, log, bufferAllocator), createInternalProtocolInitializer(internalBoltProtocolFactory, throttleGroup, bufferAllocator), loopbackProtocolInitializer, connectorPortRegister, logService, config);
} else {
nettyServer = new NettyServer(jobScheduler.threadFactory(Group.BOLT_NETWORK_IO), createExternalProtocolInitializer(externalBoltProtocolFactory, throttleGroup, log, bufferAllocator), loopbackProtocolInitializer, connectorPortRegister, logService, config);
}
life.add(nettyServer);
log.info("Bolt server loaded");
}
life.init();
}
Aggregations