Skip to content

Commit

Permalink
Rename discovery implementation config setting
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewkerr9000 committed Sep 12, 2018
1 parent 282174e commit fc43ec9
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
Expand Up @@ -240,8 +240,8 @@ public HostnameResolver getHostnameResolver( LogProvider logProvider, LogProvide
setting( "causal_clustering.discovery_type", options( DiscoveryType.class ), DiscoveryType.LIST.name() );

@Description( "Select the middleware used for cluster topology discovery" )
public static final Setting<DiscoveryServiceFactorySelector.DiscoveryMiddleware> middleware_type =
setting( "causal_clustering.middleware_type", options( DiscoveryServiceFactorySelector.DiscoveryMiddleware.class ),
public static final Setting<DiscoveryServiceFactorySelector.DiscoveryImplementation> discovery_implementation =
setting( "causal_clustering.discovery_implementation", options( DiscoveryServiceFactorySelector.DiscoveryImplementation.class ),
DiscoveryServiceFactorySelector.DEFAULT.name() );

@Description( "Prevents the network middleware from dumping its own logs. Defaults to true." )
Expand Down
Expand Up @@ -27,17 +27,17 @@

public abstract class DiscoveryServiceFactorySelector<T extends DiscoveryServiceFactory>
{
public static DiscoveryMiddleware DEFAULT = DiscoveryMiddleware.hazelcast;
public static DiscoveryImplementation DEFAULT = DiscoveryImplementation.hazelcast;

public T select( Config config )
{
DiscoveryMiddleware middleware = config.get( CausalClusteringSettings.middleware_type );
DiscoveryImplementation middleware = config.get( CausalClusteringSettings.discovery_implementation );
return select( middleware );
}

protected abstract T select( DiscoveryMiddleware middleware );
protected abstract T select( DiscoveryImplementation middleware );

public enum DiscoveryMiddleware
public enum DiscoveryImplementation
{
hazelcast, akka
}
Expand Down
Expand Up @@ -25,7 +25,7 @@
public class EnterpriseDiscoveryServiceFactorySelector extends DiscoveryServiceFactorySelector<DiscoveryServiceFactory>
{
@Override
protected DiscoveryServiceFactory select( DiscoveryMiddleware middleware )
protected DiscoveryServiceFactory select( DiscoveryImplementation middleware )
{
switch ( middleware )
{
Expand Down
Expand Up @@ -70,7 +70,7 @@ public static class Builder implements WithCores, WithReplicas, WithLogger, With
private PortPickingFactory portFactory = PortPickingFactory.DEFAULT;
private final Map<String, String> config = new HashMap<>();
private List<String> databases = new ArrayList<>( Collections.singletonList( "default" ) );
private DiscoveryServiceFactorySelector.DiscoveryMiddleware discoveryServiceFactory = DiscoveryServiceFactorySelector.DEFAULT;
private DiscoveryServiceFactorySelector.DiscoveryImplementation discoveryServiceFactory = DiscoveryServiceFactorySelector.DEFAULT;

@Override
public WithReplicas withCores( int n )
Expand Down Expand Up @@ -124,7 +124,7 @@ public Builder withOptionalDatabases( List<String> databaseNames )
}

@Override
public Builder withDiscoveryServiceFactory( DiscoveryServiceFactorySelector.DiscoveryMiddleware discoveryServiceFactory )
public Builder withDiscoveryServiceFactory( DiscoveryServiceFactorySelector.DiscoveryImplementation discoveryServiceFactory )
{
this.discoveryServiceFactory = discoveryServiceFactory;
return this;
Expand Down Expand Up @@ -172,7 +172,7 @@ interface WithOptionalDatabasesAndPorts

Builder withOptionalDatabases( List<String> databaseNames );

Builder withDiscoveryServiceFactory( DiscoveryServiceFactorySelector.DiscoveryMiddleware discoveryServiceFactory );
Builder withDiscoveryServiceFactory( DiscoveryServiceFactorySelector.DiscoveryImplementation discoveryServiceFactory );
}

/**
Expand Down Expand Up @@ -260,7 +260,7 @@ public static class CausalCluster
private final Log log;
private final PortPickingFactory portFactory;
private final Map<String,String> config;
private final DiscoveryServiceFactorySelector.DiscoveryMiddleware discoveryServiceFactory;
private final DiscoveryServiceFactorySelector.DiscoveryImplementation discoveryServiceFactory;

private List<ServerControls> coreControls = synchronizedList( new ArrayList<>() );
private List<ServerControls> replicaControls = synchronizedList( new ArrayList<>() );
Expand Down
Expand Up @@ -35,7 +35,7 @@

public class EnterpriseInProcessServerBuilder extends AbstractInProcessServerBuilder
{
private DiscoveryServiceFactorySelector.DiscoveryMiddleware discoveryServiceFactory = DiscoveryServiceFactorySelector.DEFAULT;
private DiscoveryServiceFactorySelector.DiscoveryImplementation discoveryServiceFactory = DiscoveryServiceFactorySelector.DEFAULT;

public EnterpriseInProcessServerBuilder()
{
Expand All @@ -57,7 +57,7 @@ protected AbstractNeoServer createNeoServer( Map<String,String> configMap,
GraphDatabaseFacadeFactory.Dependencies dependencies, FormattedLogProvider userLogProvider )
{
Config config = Config.defaults( configMap );
config.augment( CausalClusteringSettings.middleware_type, discoveryServiceFactory.name() );
config.augment( CausalClusteringSettings.discovery_implementation, discoveryServiceFactory.name() );
return new OpenEnterpriseNeoServer( config, dependencies, userLogProvider );
}

Expand All @@ -69,7 +69,7 @@ protected AbstractNeoServer createNeoServer( Map<String,String> configMap,
* @param discoveryService
* @return this builder instance
*/
public EnterpriseInProcessServerBuilder withDiscoveryServiceFactory( DiscoveryServiceFactorySelector.DiscoveryMiddleware discoveryService )
public EnterpriseInProcessServerBuilder withDiscoveryServiceFactory( DiscoveryServiceFactorySelector.DiscoveryImplementation discoveryService )
{
this.discoveryServiceFactory = discoveryService;
return this;
Expand Down

0 comments on commit fc43ec9

Please sign in to comment.