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