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