class SwitchToSlaveCopyThenBranch extends SwitchToSlave {

    private void copyStore( URI masterUri, URI me, CancellationRequest cancellationRequest,
                            MoveAfterCopy moveAfterCopy ) throws Throwable
    {
        boolean success = false;
        monitor.storeCopyStarted();
        LifeSupport copyLife = new LifeSupport();
        try
        {
            MasterClient masterClient = newMasterClient( masterUri, me, null, copyLife );
            copyLife.start();

            boolean masterIsOld = MasterClient.CURRENT.compareTo( masterClient.getProtocolVersion() ) > 0;
            if ( masterIsOld )
            {
                throw new UnableToCopyStoreFromOldMasterException( MasterClient.CURRENT.getApplicationProtocol(),
                        masterClient.getProtocolVersion().getApplicationProtocol() );
            }
            else
            {
                copyStoreFromMaster( masterClient, cancellationRequest, moveAfterCopy );
                success = true;
            }
        }
        finally
        {
            monitor.storeCopyCompleted( success );
            copyLife.shutdown();
        }
    }

    public  SwitchToSlaveCopyThenBranch( DatabaseLayout databaseLayout, LogService logService, FileSystemAbstraction fileSystemAbstraction, Config config,
            HaIdGeneratorFactory idGeneratorFactory, DelegateInvocationHandler<Master> masterDelegateHandler,
            ClusterMemberAvailability clusterMemberAvailability, RequestContextFactory requestContextFactory, PullerFactory pullerFactory,
            Iterable<KernelExtensionFactory<?>> kernelExtensions, MasterClientResolver masterClientResolver, Monitor monitor,
            StoreCopyClientMonitor storeCopyMonitor, Supplier<NeoStoreDataSource> neoDataSourceSupplier,
            Supplier<TransactionIdStore> transactionIdStoreSupplier, Function<Slave,SlaveServer> slaveServerFactory, UpdatePuller updatePuller,
            PageCache pageCache, Monitors monitors, Supplier<DatabaseTransactionStats> transactionStatsSupplier );
      SwitchToSlaveCopyThenBranch( DatabaseLayout databaseLayout,
                                 LogService logService,
                                 Config config,
                                 HaIdGeneratorFactory idGeneratorFactory,
                                 DelegateInvocationHandler<Master> masterDelegateHandler,
                                 ClusterMemberAvailability clusterMemberAvailability,
                                 RequestContextFactory requestContextFactory,
                                 PullerFactory pullerFactory,
                                 MasterClientResolver masterClientResolver,
                                 SwitchToSlave.Monitor monitor,
                                 StoreCopyClient storeCopyClient,
                                 Supplier<NeoStoreDataSource> neoDataSourceSupplier,
                                 Supplier<TransactionIdStore> transactionIdStoreSupplier,
                                 Function<Slave, SlaveServer> slaveServerFactory,
                                 UpdatePuller updatePuller,
                                 PageCache pageCache,
                                 Monitors monitors,
                                 Supplier<DatabaseTransactionStats> transactionStatsSupplier );

}