use of org.neo4j.kernel.ha.transaction.CommitPusher in project neo4j by neo4j.
the class TestMasterCommittingAtSlave method newPropagator.
private TransactionPropagator newPropagator(int slaveCount, int replication, SlavePriority slavePriority, boolean... failingSlaves) throws Exception {
slaves = instantiateSlaves(slaveCount, failingSlaves);
Config config = Config.embeddedDefaults(MapUtil.stringMap(HaSettings.tx_push_factor.name(), "" + replication, ClusterSettings.server_id.name(), "" + MasterServerId));
Neo4jJobScheduler scheduler = cleanup.add(new Neo4jJobScheduler());
TransactionPropagator result = new TransactionPropagator(TransactionPropagator.from(config, slavePriority), NullLog.getInstance(), new Slaves() {
@Override
public Iterable<Slave> getSlaves() {
return slaves;
}
}, new CommitPusher(scheduler));
// Life
try {
scheduler.init();
scheduler.start();
result.init();
result.start();
} catch (Throwable e) {
throw Exceptions.launderedException(e);
}
return result;
}
use of org.neo4j.kernel.ha.transaction.CommitPusher 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);
}
Aggregations