use of org.neo4j.kernel.ha.cluster.modeswitch.PropertyKeyCreatorSwitcher in project neo4j by neo4j.
the class HighlyAvailableEditionModule method createPropertyKeyCreator.
private TokenCreator createPropertyKeyCreator(Config config, ComponentSwitcherContainer componentSwitcherContainer, DelegateInvocationHandler<Master> masterDelegateInvocationHandler, RequestContextFactory requestContextFactory, Supplier<KernelAPI> kernelProvider) {
if (config.get(GraphDatabaseSettings.read_only)) {
return new ReadOnlyTokenCreator();
}
DelegateInvocationHandler<TokenCreator> propertyKeyCreatorDelegate = new DelegateInvocationHandler<>(TokenCreator.class);
TokenCreator propertyTokenCreator = (TokenCreator) newProxyInstance(TokenCreator.class.getClassLoader(), new Class[] { TokenCreator.class }, propertyKeyCreatorDelegate);
PropertyKeyCreatorSwitcher propertyKeyCreatorModeSwitcher = new PropertyKeyCreatorSwitcher(propertyKeyCreatorDelegate, masterDelegateInvocationHandler, requestContextFactory, kernelProvider, idGeneratorFactory);
componentSwitcherContainer.add(propertyKeyCreatorModeSwitcher);
return propertyTokenCreator;
}
Aggregations