本文整理了Java中org.neo4j.kernel.configuration.Config.enabledBoltConnectors()
方法的一些代码示例,展示了Config.enabledBoltConnectors()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Config.enabledBoltConnectors()
方法的具体详情如下:
包路径:org.neo4j.kernel.configuration.Config
类名称:Config
方法名:enabledBoltConnectors
暂无
代码示例来源:origin: neo4j/neo4j
/**
* @return list of all configured bolt connectors which are enabled
*/
@Nonnull
public List<BoltConnector> enabledBoltConnectors()
{
return enabledBoltConnectors( params );
}
代码示例来源:origin: neo4j/neo4j
private Map<BoltConnector,ProtocolInitializer> createConnectors( BoltProtocolFactory boltProtocolFactory,
TransportThrottleGroup throttleGroup, Log log )
{
return config.enabledBoltConnectors()
.stream()
.collect( toMap( identity(), connector -> createProtocolInitializer( connector, boltProtocolFactory, throttleGroup, log ) ) );
}
代码示例来源:origin: neo4j/neo4j
@Override
public URI boltURI()
{
List<BoltConnector> connectors = server.getConfig().enabledBoltConnectors();
BoltConnector defaultConnector = null;
BoltConnector firstConnector = null;
for ( BoltConnector connector : connectors )
{
if ( DEFAULT_BOLT_CONNECTOR_KEY.equals( connector.key() ) )
{
defaultConnector = connector;
}
if ( firstConnector == null )
{
firstConnector = connector;
}
}
if ( defaultConnector != null )
{
// bolt connector with default key is configured, return its address
return connectorUri( "bolt", defaultConnector );
}
if ( firstConnector != null )
{
// some bolt connector is configured, return its address
return connectorUri( "bolt", firstConnector );
}
throw new IllegalStateException( "Bolt connector is not configured" );
}
代码示例来源:origin: neo4j/neo4j
@Test
void shouldBeAbleToDisableBoltConnectorWithJustOneParameter()
{
// given
Config config = Config.defaults( new BoltConnector( "bolt" ).enabled, "false" );
// then
assertThat( config.boltConnectors().size(), is( 1 ) );
assertThat( config.enabledBoltConnectors(), empty() );
}
代码示例来源:origin: neo4j/neo4j
@Override
public void start()
{
forkJoinThreadPool = new ForkJoinPool();
config.enabledBoltConnectors().forEach( connector ->
{
BoltScheduler boltScheduler =
new ExecutorBoltScheduler( connector.key(), executorFactory, scheduler, logService, config.get( connector.thread_pool_min_size ),
config.get( connector.thread_pool_max_size ), config.get( connector.thread_pool_keep_alive ),
config.get( connector.unsupported_thread_pool_queue_size ), forkJoinThreadPool );
boltScheduler.start();
boltSchedulers.put( connector.key(), boltScheduler );
} );
}
代码示例来源:origin: neo4j/neo4j
public Builder addBoltConnectorFromConfig( String key, String scheme, Config config, Setting<URI> override, ConnectorPortRegister portRegister )
{
// If an override is configured, add it with the HIGHEST precedence
if ( config.isConfigured( override ) )
{
add( key, config.get( override ), HIGHEST );
}
config.enabledBoltConnectors().stream().findFirst().ifPresent( c ->
{
AdvertisedSocketAddress address = config.get( c.advertised_address );
int port = address.getPort();
if ( port == 0 )
{
port = portRegister.getLocalAddress( c.key() ).getPort();
}
// If advertised address is explicitly set, set the precedence to HIGH - eitherwise set it as LOWEST (default)
add( key, scheme, address.getHostname(), port, config.isConfigured( c.advertised_address ) ? HIGH : LOWEST );
} );
return this;
}
代码示例来源:origin: neo4j/neo4j
@Override
public void start() throws Throwable
{
Log log = logService.getInternalLog( BoltServer.class );
Log userLog = logService.getUserLog( BoltServer.class );
InternalLoggerFactory.setDefaultFactory( new Netty4LoggerFactory( logService.getInternalLogProvider() ) );
Authentication authentication = createAuthentication();
TransportThrottleGroup throttleGroup = new TransportThrottleGroup( config, clock );
BoltSchedulerProvider boltSchedulerProvider =
life.add( new ExecutorBoltSchedulerProvider( config, new CachedThreadPoolExecutorFactory( log ), jobScheduler, logService ) );
BoltConnectionFactory boltConnectionFactory =
createConnectionFactory( config, boltSchedulerProvider, throttleGroup, logService, clock );
BoltStateMachineFactory boltStateMachineFactory = createBoltFactory( authentication, clock );
BoltProtocolFactory boltProtocolFactory = createBoltProtocolFactory( boltConnectionFactory, boltStateMachineFactory );
if ( !config.enabledBoltConnectors().isEmpty() && !config.get( GraphDatabaseSettings.disconnected ) )
{
NettyServer server = new NettyServer( jobScheduler.threadFactory( Group.BOLT_NETWORK_IO ),
createConnectors( boltProtocolFactory, throttleGroup, log ), connectorPortRegister, userLog );
life.add( server );
log.info( "Bolt server loaded" );
}
life.start(); // init and start the nested lifecycle
}
代码示例来源:origin: neo4j-contrib/neo4j-apoc-procedures
private Optional<String> getBoltConnector()
{
Config config = api.getDependencyResolver().resolveDependency( Config.class );
final Optional<BoltConnector> boltConnector = config.enabledBoltConnectors().stream().findFirst();
if ( boltConnector.isPresent() )
{
AdvertisedSocketAddress from = boltConnector.get().advertised_address.from( config );
return Optional.of( "bolt://" + from );
}
return Optional.empty();
}
代码示例来源:origin: org.neo4j/neo4j-kernel
/**
* @return list of all configured bolt connectors which are enabled
*/
@Nonnull
public List<BoltConnector> enabledBoltConnectors()
{
return enabledBoltConnectors( params );
}
代码示例来源:origin: org.neo4j/neo4j-bolt
private Map<BoltConnector,ProtocolInitializer> createConnectors( BoltProtocolFactory boltProtocolFactory,
TransportThrottleGroup throttleGroup, Log log )
{
return config.enabledBoltConnectors()
.stream()
.collect( toMap( identity(), connector -> createProtocolInitializer( connector, boltProtocolFactory, throttleGroup, log ) ) );
}
代码示例来源:origin: org.neo4j/neo4j-causal-clustering
private void validateBoltConnector( Config config )
{
if ( config.enabledBoltConnectors().isEmpty() )
{
throw new InvalidSettingException( "A Bolt connector must be configured to run a cluster" );
}
}
代码示例来源:origin: org.neo4j/neo4j-causal-clustering
static ClientConnectorAddresses extractFromConfig( Config config )
{
List<ConnectorUri> connectorUris = new ArrayList<>();
List<BoltConnector> boltConnectors = config.enabledBoltConnectors();
if ( boltConnectors.isEmpty() )
{
throw new IllegalArgumentException( "A Bolt connector must be configured to run a cluster" );
}
boltConnectors
.forEach( c -> connectorUris.add( new ConnectorUri( bolt, config.get( c.advertised_address ) ) ) );
config.enabledHttpConnectors()
.forEach( c -> connectorUris.add( new ConnectorUri( Encryption.NONE.equals(c.encryptionLevel() ) ?
http : https, config.get( c.advertised_address ) ) ) );
return new ClientConnectorAddresses( connectorUris );
}
代码示例来源:origin: org.neo4j.test/neo4j-harness
@Override
public URI boltURI()
{
List<BoltConnector> connectors = server.getConfig().enabledBoltConnectors();
BoltConnector defaultConnector = null;
BoltConnector firstConnector = null;
for ( BoltConnector connector : connectors )
{
if ( DEFAULT_BOLT_CONNECTOR_KEY.equals( connector.key() ) )
{
defaultConnector = connector;
}
if ( firstConnector == null )
{
firstConnector = connector;
}
}
if ( defaultConnector != null )
{
// bolt connector with default key is configured, return its address
return connectorUri( "bolt", defaultConnector );
}
if ( firstConnector != null )
{
// some bolt connector is configured, return its address
return connectorUri( "bolt", firstConnector );
}
throw new IllegalStateException( "Bolt connector is not configured" );
}
代码示例来源:origin: org.neo4j/neo4j-bolt
@Override
public void start()
{
forkJoinThreadPool = new ForkJoinPool();
config.enabledBoltConnectors().forEach( connector ->
{
BoltScheduler boltScheduler =
new ExecutorBoltScheduler( connector.key(), executorFactory, scheduler, logService, config.get( connector.thread_pool_min_size ),
config.get( connector.thread_pool_max_size ), config.get( connector.thread_pool_keep_alive ),
config.get( connector.unsupported_thread_pool_queue_size ), forkJoinThreadPool );
boltScheduler.start();
boltSchedulers.put( connector.key(), boltScheduler );
} );
}
代码示例来源:origin: org.neo4j.app/neo4j-server
public Builder addBoltConnectorFromConfig( String key, String scheme, Config config, Setting<URI> override, ConnectorPortRegister portRegister )
{
// If an override is configured, add it with the HIGHEST precedence
if ( config.isConfigured( override ) )
{
add( key, config.get( override ), HIGHEST );
}
config.enabledBoltConnectors().stream().findFirst().ifPresent( c ->
{
AdvertisedSocketAddress address = config.get( c.advertised_address );
int port = address.getPort();
if ( port == 0 )
{
port = portRegister.getLocalAddress( c.key() ).getPort();
}
// If advertised address is explicitly set, set the precedence to HIGH - eitherwise set it as LOWEST (default)
add( key, scheme, address.getHostname(), port, config.isConfigured( c.advertised_address ) ? HIGH : LOWEST );
} );
return this;
}
代码示例来源:origin: org.neo4j/neo4j-bolt
@Override
public void start() throws Throwable
{
Log log = logService.getInternalLog( BoltServer.class );
Log userLog = logService.getUserLog( BoltServer.class );
InternalLoggerFactory.setDefaultFactory( new Netty4LoggerFactory( logService.getInternalLogProvider() ) );
Authentication authentication = createAuthentication();
TransportThrottleGroup throttleGroup = new TransportThrottleGroup( config, clock );
BoltSchedulerProvider boltSchedulerProvider =
life.add( new ExecutorBoltSchedulerProvider( config, new CachedThreadPoolExecutorFactory( log ), jobScheduler, logService ) );
BoltConnectionFactory boltConnectionFactory =
createConnectionFactory( config, boltSchedulerProvider, throttleGroup, logService, clock );
BoltStateMachineFactory boltStateMachineFactory = createBoltFactory( authentication, clock );
BoltProtocolFactory boltProtocolFactory = createBoltProtocolFactory( boltConnectionFactory, boltStateMachineFactory );
if ( !config.enabledBoltConnectors().isEmpty() && !config.get( GraphDatabaseSettings.disconnected ) )
{
NettyServer server = new NettyServer( jobScheduler.threadFactory( Group.BOLT_NETWORK_IO ),
createConnectors( boltProtocolFactory, throttleGroup, log ), connectorPortRegister, userLog );
life.add( server );
log.info( "Bolt server loaded" );
}
life.start(); // init and start the nested lifecycle
}
内容来源于网络,如有侵权,请联系作者删除!