Search in sources :

Example 6 with DelegateInvocationHandler

use of org.neo4j.kernel.ha.DelegateInvocationHandler in project neo4j by neo4j.

the class HighlyAvailableEditionModule method createCommitProcessFactory.

private CommitProcessFactory createCommitProcessFactory(Dependencies dependencies, LogService logging, Monitors monitors, Config config, LifeSupport paxosLife, ClusterClient clusterClient, ClusterMembers members, JobScheduler jobScheduler, Master master, RequestContextFactory requestContextFactory, ComponentSwitcherContainer componentSwitcherContainer, Supplier<LogEntryReader<ReadableClosablePositionAwareChannel>> logEntryReader) {
    DefaultSlaveFactory slaveFactory = dependencies.satisfyDependency(new DefaultSlaveFactory(logging.getInternalLogProvider(), monitors, config.get(HaSettings.com_chunk_size).intValue(), logEntryReader));
    HostnamePort me = config.get(ClusterSettings.cluster_server);
    Slaves slaves = dependencies.satisfyDependency(paxosLife.add(new HighAvailabilitySlaves(members, clusterClient, slaveFactory, me)));
    TransactionPropagator transactionPropagator = new TransactionPropagator(TransactionPropagator.from(config), logging.getInternalLog(TransactionPropagator.class), slaves, new CommitPusher(jobScheduler));
    paxosLife.add(transactionPropagator);
    DelegateInvocationHandler<TransactionCommitProcess> commitProcessDelegate = new DelegateInvocationHandler<>(TransactionCommitProcess.class);
    CommitProcessSwitcher commitProcessSwitcher = new CommitProcessSwitcher(transactionPropagator, master, commitProcessDelegate, requestContextFactory, lockManager, monitors, dependencies, config.get(GraphDatabaseSettings.release_schema_lock_while_building_constraint));
    componentSwitcherContainer.add(commitProcessSwitcher);
    return new HighlyAvailableCommitProcessFactory(commitProcessDelegate);
}
Also used : TransactionPropagator(org.neo4j.kernel.ha.transaction.TransactionPropagator) CommitPusher(org.neo4j.kernel.ha.transaction.CommitPusher) HostnamePort(org.neo4j.helpers.HostnamePort) TransactionCommitProcess(org.neo4j.kernel.impl.api.TransactionCommitProcess) DefaultSlaveFactory(org.neo4j.kernel.ha.com.master.DefaultSlaveFactory) DelegateInvocationHandler(org.neo4j.kernel.ha.DelegateInvocationHandler) CommitProcessSwitcher(org.neo4j.kernel.ha.cluster.modeswitch.CommitProcessSwitcher) HighAvailabilitySlaves(org.neo4j.kernel.ha.cluster.member.HighAvailabilitySlaves) Slaves(org.neo4j.kernel.ha.com.master.Slaves) HighAvailabilitySlaves(org.neo4j.kernel.ha.cluster.member.HighAvailabilitySlaves)

Example 7 with DelegateInvocationHandler

use of org.neo4j.kernel.ha.DelegateInvocationHandler 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;
}
Also used : PropertyKeyCreatorSwitcher(org.neo4j.kernel.ha.cluster.modeswitch.PropertyKeyCreatorSwitcher) ReadOnlyTokenCreator(org.neo4j.kernel.impl.core.ReadOnlyTokenCreator) DelegateInvocationHandler(org.neo4j.kernel.ha.DelegateInvocationHandler) ReadOnlyTokenCreator(org.neo4j.kernel.impl.core.ReadOnlyTokenCreator) TokenCreator(org.neo4j.kernel.impl.core.TokenCreator)

Aggregations

DelegateInvocationHandler (org.neo4j.kernel.ha.DelegateInvocationHandler)7 ReadOnlyTokenCreator (org.neo4j.kernel.impl.core.ReadOnlyTokenCreator)3 TokenCreator (org.neo4j.kernel.impl.core.TokenCreator)3 Test (org.junit.Test)2 TransactionCommitProcess (org.neo4j.kernel.impl.api.TransactionCommitProcess)2 File (java.io.File)1 IOException (java.io.IOException)1 InetSocketAddress (java.net.InetSocketAddress)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)1 AtomicReference (java.util.concurrent.atomic.AtomicReference)1 InstanceId (org.neo4j.cluster.InstanceId)1 ClusterClient (org.neo4j.cluster.client.ClusterClient)1 ClusterMemberAvailability (org.neo4j.cluster.member.ClusterMemberAvailability)1 Election (org.neo4j.cluster.protocol.election.Election)1 DependencyResolver (org.neo4j.graphdb.DependencyResolver)1 HostnamePort (org.neo4j.helpers.HostnamePort)1 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)1 PageCache (org.neo4j.io.pagecache.PageCache)1 PagedFile (org.neo4j.io.pagecache.PagedFile)1