Search in sources :

Example 1 with TransactionObligationFulfiller

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;
}
Also used : Slave(org.neo4j.kernel.ha.com.master.Slave) TransactionObligationFulfiller(org.neo4j.com.storecopy.TransactionObligationFulfiller) UpdatePullerScheduler(org.neo4j.kernel.ha.UpdatePullerScheduler) MasterClient(org.neo4j.kernel.ha.com.slave.MasterClient) SlaveServer(org.neo4j.kernel.ha.com.slave.SlaveServer) URI(java.net.URI) SlaveImpl(org.neo4j.kernel.ha.com.slave.SlaveImpl)

Aggregations

URI (java.net.URI)1 TransactionObligationFulfiller (org.neo4j.com.storecopy.TransactionObligationFulfiller)1 UpdatePullerScheduler (org.neo4j.kernel.ha.UpdatePullerScheduler)1 Slave (org.neo4j.kernel.ha.com.master.Slave)1 MasterClient (org.neo4j.kernel.ha.com.slave.MasterClient)1 SlaveImpl (org.neo4j.kernel.ha.com.slave.SlaveImpl)1 SlaveServer (org.neo4j.kernel.ha.com.slave.SlaveServer)1