use of org.neo4j.com.storecopy.TransactionObligationFulfiller in project neo4j by neo4j.
the class SwitchToSlave method startHaCommunication.
private URI startHaCommunication(LifeSupport haCommunicationLife, NeoStoreDataSource neoDataSource, URI me, URI masterUri, StoreId storeId, CancellationRequest cancellationRequest) throws IllegalArgumentException, InterruptedException {
MasterClient master = newMasterClient(masterUri, me, neoDataSource.getStoreId(), haCommunicationLife);
TransactionObligationFulfiller obligationFulfiller = resolver.resolveDependency(TransactionObligationFulfiller.class);
UpdatePullerScheduler updatePullerScheduler = updatePullerFactory.createUpdatePullerScheduler(updatePuller);
Slave slaveImpl = new SlaveImpl(obligationFulfiller);
SlaveServer server = slaveServerFactory.apply(slaveImpl);
if (cancellationRequest.cancellationRequested()) {
msgLog.info("Switch to slave cancelled, unable to start HA-communication");
return null;
}
masterDelegateHandler.setDelegate(master);
haCommunicationLife.add(updatePullerScheduler);
haCommunicationLife.add(server);
haCommunicationLife.start();
/*
* Take the opportunity to catch up with master, now that we're alone here, right before we
* drop the availability guard, so that other transactions might start.
*/
if (!catchUpWithMaster(updatePuller)) {
return null;
}
URI slaveHaURI = createHaURI(me, server);
clusterMemberAvailability.memberIsAvailable(HighAvailabilityModeSwitcher.SLAVE, slaveHaURI, storeId);
return slaveHaURI;
}
Aggregations