Skip to content

Commit

Permalink
Change name from Enableable to Suspendable
Browse files Browse the repository at this point in the history
  • Loading branch information
RagnarW committed Apr 20, 2018
1 parent c64434b commit 95d60bc
Show file tree
Hide file tree
Showing 17 changed files with 100 additions and 99 deletions.
Expand Up @@ -37,7 +37,7 @@
import org.neo4j.causalclustering.core.consensus.schedule.TimerService.TimerName; import org.neo4j.causalclustering.core.consensus.schedule.TimerService.TimerName;
import org.neo4j.causalclustering.core.state.snapshot.TopologyLookupException; import org.neo4j.causalclustering.core.state.snapshot.TopologyLookupException;
import org.neo4j.causalclustering.discovery.TopologyService; import org.neo4j.causalclustering.discovery.TopologyService;
import org.neo4j.causalclustering.helper.Enableable; import org.neo4j.causalclustering.helper.Suspendable;
import org.neo4j.causalclustering.identity.MemberId; import org.neo4j.causalclustering.identity.MemberId;
import org.neo4j.causalclustering.identity.StoreId; import org.neo4j.causalclustering.identity.StoreId;
import org.neo4j.causalclustering.upstream.UpstreamDatabaseSelectionException; import org.neo4j.causalclustering.upstream.UpstreamDatabaseSelectionException;
Expand Down Expand Up @@ -86,7 +86,7 @@ enum State


private final LocalDatabase localDatabase; private final LocalDatabase localDatabase;
private final Log log; private final Log log;
private final Enableable enableDisableOnStoreCopy; private final Suspendable enableDisableOnStoreCopy;
private final StoreCopyProcess storeCopyProcess; private final StoreCopyProcess storeCopyProcess;
private final Supplier<DatabaseHealth> databaseHealthSupplier; private final Supplier<DatabaseHealth> databaseHealthSupplier;
private final CatchUpClient catchUpClient; private final CatchUpClient catchUpClient;
Expand All @@ -103,7 +103,7 @@ enum State
private CompletableFuture<Boolean> upToDateFuture; // we are up-to-date when we are successfully pulling private CompletableFuture<Boolean> upToDateFuture; // we are up-to-date when we are successfully pulling
private volatile long latestTxIdOfUpStream; private volatile long latestTxIdOfUpStream;


public CatchupPollingProcess( LogProvider logProvider, LocalDatabase localDatabase, Enableable enableDisableOnSoreCopy, CatchUpClient catchUpClient, public CatchupPollingProcess( LogProvider logProvider, LocalDatabase localDatabase, Suspendable enableDisableOnSoreCopy, CatchUpClient catchUpClient,
UpstreamDatabaseStrategySelector selectionStrategy, TimerService timerService, long txPullIntervalMillis, UpstreamDatabaseStrategySelector selectionStrategy, TimerService timerService, long txPullIntervalMillis,
BatchingTxApplier applier, Monitors monitors, StoreCopyProcess storeCopyProcess, BatchingTxApplier applier, Monitors monitors, StoreCopyProcess storeCopyProcess,
Supplier<DatabaseHealth> databaseHealthSupplier, TopologyService topologyService ) Supplier<DatabaseHealth> databaseHealthSupplier, TopologyService topologyService )
Expand Down
Expand Up @@ -63,10 +63,10 @@
import org.neo4j.causalclustering.core.state.snapshot.CoreStateDownloaderService; import org.neo4j.causalclustering.core.state.snapshot.CoreStateDownloaderService;
import org.neo4j.causalclustering.core.state.storage.DurableStateStorage; import org.neo4j.causalclustering.core.state.storage.DurableStateStorage;
import org.neo4j.causalclustering.core.state.storage.StateStorage; import org.neo4j.causalclustering.core.state.storage.StateStorage;
import org.neo4j.causalclustering.helper.CompositeEnableable; import org.neo4j.causalclustering.helper.CompositeSuspendable;
import org.neo4j.causalclustering.helper.ExponentialBackoffStrategy; import org.neo4j.causalclustering.helper.ExponentialBackoffStrategy;
import org.neo4j.causalclustering.messaging.LifecycleMessageHandler; import org.neo4j.causalclustering.messaging.LifecycleMessageHandler;
import org.neo4j.causalclustering.helper.Enableable; import org.neo4j.causalclustering.helper.Suspendable;
import org.neo4j.causalclustering.net.InstalledProtocolHandler; import org.neo4j.causalclustering.net.InstalledProtocolHandler;
import org.neo4j.causalclustering.net.Server; import org.neo4j.causalclustering.net.Server;
import org.neo4j.causalclustering.protocol.ModifierProtocolInstaller; import org.neo4j.causalclustering.protocol.ModifierProtocolInstaller;
Expand All @@ -89,7 +89,6 @@
import org.neo4j.kernel.impl.util.Dependencies; import org.neo4j.kernel.impl.util.Dependencies;
import org.neo4j.kernel.internal.DatabaseHealth; import org.neo4j.kernel.internal.DatabaseHealth;
import org.neo4j.kernel.lifecycle.LifeSupport; import org.neo4j.kernel.lifecycle.LifeSupport;
import org.neo4j.kernel.monitoring.Monitors;
import org.neo4j.logging.LogProvider; import org.neo4j.logging.LogProvider;
import org.neo4j.scheduler.JobScheduler; import org.neo4j.scheduler.JobScheduler;


Expand Down Expand Up @@ -147,7 +146,7 @@ public CoreServerModule( IdentityModule identityModule, final PlatformModule pla
this.logProvider = logging.getInternalLogProvider(); this.logProvider = logging.getInternalLogProvider();
LogProvider userLogProvider = logging.getUserLogProvider(); LogProvider userLogProvider = logging.getUserLogProvider();


CompositeEnableable servicesToStopOnStoreCopy = new CompositeEnableable(); CompositeSuspendable servicesToStopOnStoreCopy = new CompositeSuspendable();


StateStorage<Long> lastFlushedStorage = platformModule.life.add( StateStorage<Long> lastFlushedStorage = platformModule.life.add(
new DurableStateStorage<>( platformModule.fileSystem, clusterStateDirectory, LAST_FLUSHED_NAME, new LongIndexMarshal(), new DurableStateStorage<>( platformModule.fileSystem, clusterStateDirectory, LAST_FLUSHED_NAME, new LongIndexMarshal(),
Expand Down Expand Up @@ -251,7 +250,7 @@ private CatchUpClient createCatchupClient( NettyPipelineBuilderFactory clientPip
return catchUpClient; return catchUpClient;
} }


private CoreStateDownloader createCoreStateDownloader( Enableable servicesToStopOnStoreCopy, CatchUpClient catchUpClient ) private CoreStateDownloader createCoreStateDownloader( Suspendable servicesToSuspendOnStoreCopy, CatchUpClient catchUpClient )
{ {
ExponentialBackoffStrategy storeCopyBackoffStrategy = ExponentialBackoffStrategy storeCopyBackoffStrategy =
new ExponentialBackoffStrategy( 1, config.get( CausalClusteringSettings.store_copy_backoff_max_wait ).toMillis(), TimeUnit.MILLISECONDS ); new ExponentialBackoffStrategy( 1, config.get( CausalClusteringSettings.store_copy_backoff_max_wait ).toMillis(), TimeUnit.MILLISECONDS );
Expand All @@ -267,8 +266,8 @@ private CoreStateDownloader createCoreStateDownloader( Enableable servicesToStop
copiedStoreRecovery, remoteStore, logProvider ); copiedStoreRecovery, remoteStore, logProvider );


CommitStateHelper commitStateHelper = new CommitStateHelper( platformModule.pageCache, platformModule.fileSystem, config ); CommitStateHelper commitStateHelper = new CommitStateHelper( platformModule.pageCache, platformModule.fileSystem, config );
return new CoreStateDownloader( localDatabase, servicesToStopOnStoreCopy, remoteStore, catchUpClient, logProvider, return new CoreStateDownloader( localDatabase, servicesToSuspendOnStoreCopy, remoteStore, catchUpClient, logProvider,
storeCopyProcess, coreStateMachinesModule.coreStateMachines, snapshotService, commitStateHelper ); storeCopyProcess, coreStateMachinesModule.coreStateMachines, snapshotService, commitStateHelper );
} }


private MembershipWaiterLifecycle createMembershipWaiterLifecycle() private MembershipWaiterLifecycle createMembershipWaiterLifecycle()
Expand Down
Expand Up @@ -37,7 +37,7 @@
import org.neo4j.causalclustering.catchup.storecopy.StoreIdDownloadFailedException; import org.neo4j.causalclustering.catchup.storecopy.StoreIdDownloadFailedException;
import org.neo4j.causalclustering.core.state.CoreSnapshotService; import org.neo4j.causalclustering.core.state.CoreSnapshotService;
import org.neo4j.causalclustering.core.state.machines.CoreStateMachines; import org.neo4j.causalclustering.core.state.machines.CoreStateMachines;
import org.neo4j.causalclustering.helper.Enableable; import org.neo4j.causalclustering.helper.Suspendable;
import org.neo4j.causalclustering.identity.StoreId; import org.neo4j.causalclustering.identity.StoreId;
import org.neo4j.helpers.AdvertisedSocketAddress; import org.neo4j.helpers.AdvertisedSocketAddress;
import org.neo4j.kernel.lifecycle.LifecycleException; import org.neo4j.kernel.lifecycle.LifecycleException;
Expand All @@ -51,7 +51,7 @@
public class CoreStateDownloader public class CoreStateDownloader
{ {
private final LocalDatabase localDatabase; private final LocalDatabase localDatabase;
private final Enableable enableDisableOnStoreCopy; private final Suspendable suspendOnStoreCopy;
private final RemoteStore remoteStore; private final RemoteStore remoteStore;
private final CatchUpClient catchUpClient; private final CatchUpClient catchUpClient;
private final Log log; private final Log log;
Expand All @@ -60,13 +60,13 @@ public class CoreStateDownloader
private final CoreSnapshotService snapshotService; private final CoreSnapshotService snapshotService;
private CommitStateHelper commitStateHelper; private CommitStateHelper commitStateHelper;


public CoreStateDownloader( LocalDatabase localDatabase, Enableable enableDisableOnStoreCopy, RemoteStore remoteStore, public CoreStateDownloader( LocalDatabase localDatabase, Suspendable suspendOnStoreCopy, RemoteStore remoteStore,
CatchUpClient catchUpClient, LogProvider logProvider, StoreCopyProcess storeCopyProcess, CatchUpClient catchUpClient, LogProvider logProvider, StoreCopyProcess storeCopyProcess,
CoreStateMachines coreStateMachines, CoreSnapshotService snapshotService, CoreStateMachines coreStateMachines, CoreSnapshotService snapshotService,
CommitStateHelper commitStateHelper ) CommitStateHelper commitStateHelper )
{ {
this.localDatabase = localDatabase; this.localDatabase = localDatabase;
this.enableDisableOnStoreCopy = enableDisableOnStoreCopy; this.suspendOnStoreCopy = suspendOnStoreCopy;
this.remoteStore = remoteStore; this.remoteStore = remoteStore;
this.catchUpClient = catchUpClient; this.catchUpClient = catchUpClient;
this.log = logProvider.getLog( getClass() ); this.log = logProvider.getLog( getClass() );
Expand Down Expand Up @@ -129,7 +129,7 @@ boolean downloadSnapshot( CatchupAddressProvider addressProvider )
return false; return false;
} }


ensure( enableDisableOnStoreCopy::disable, "disable auxiliary services before store copy" ); ensure( suspendOnStoreCopy::disable, "disable auxiliary services before store copy" );
ensure( localDatabase::stopForStoreCopy, "stop local database for store copy" ); ensure( localDatabase::stopForStoreCopy, "stop local database for store copy" );


log.info( "Downloading snapshot from core server at %s", primary ); log.info( "Downloading snapshot from core server at %s", primary );
Expand Down Expand Up @@ -211,7 +211,7 @@ else if ( catchupResult != SUCCESS_END_OF_STREAM )
ensure( localDatabase::start, "start local database after store copy" ); ensure( localDatabase::start, "start local database after store copy" );


coreStateMachines.installCommitProcess( localDatabase.getCommitProcess() ); coreStateMachines.installCommitProcess( localDatabase.getCommitProcess() );
ensure( enableDisableOnStoreCopy::enable, "enable auxiliary services after store copy" ); ensure( suspendOnStoreCopy::enable, "enable auxiliary services after store copy" );


return true; return true;
} }
Expand Down
Expand Up @@ -24,36 +24,36 @@


import org.neo4j.function.ThrowingConsumer; import org.neo4j.function.ThrowingConsumer;


public class CompositeEnableable implements Enableable public class CompositeSuspendable implements Suspendable
{ {
private final List<Enableable> enableables = new ArrayList<>(); private final List<Suspendable> suspendables = new ArrayList<>();


public void add( Enableable enableable ) public void add( Suspendable suspendable )
{ {
enableables.add( enableable ); suspendables.add( suspendable );
} }


@Override @Override
public void enable() public void enable()
{ {
doOperation( Enableable::enable, "Enable" ); doOperation( Suspendable::enable, "Enable" );
} }


@Override @Override
public void disable() public void disable()
{ {
doOperation( Enableable::disable, "Disable" ); doOperation( Suspendable::disable, "Disable" );
} }


private void doOperation( ThrowingConsumer<Enableable,Throwable> operation, String description ) private void doOperation( ThrowingConsumer<Suspendable,Throwable> operation, String description )
{ {
try ( ErrorHandler errorHandler = new ErrorHandler( description ) ) try ( ErrorHandler errorHandler = new ErrorHandler( description ) )
{ {
for ( Enableable enableable : enableables ) for ( Suspendable suspendable : suspendables )
{ {
try try
{ {
operation.accept( enableable ); operation.accept( suspendable );
} }
catch ( Throwable throwable ) catch ( Throwable throwable )
{ {
Expand Down
Expand Up @@ -19,7 +19,7 @@
*/ */
package org.neo4j.causalclustering.helper; package org.neo4j.causalclustering.helper;


public interface Enableable public interface Suspendable
{ {
void enable() throws Throwable; void enable() throws Throwable;


Expand Down
Expand Up @@ -22,13 +22,13 @@
import org.neo4j.kernel.lifecycle.Lifecycle; import org.neo4j.kernel.lifecycle.Lifecycle;
import org.neo4j.logging.Log; import org.neo4j.logging.Log;


public abstract class EnableableLifeCycle implements Lifecycle, Enableable public abstract class SuspendableLifeCycle implements Lifecycle, Suspendable
{ {
private final Log debugLog; private final Log debugLog;
private boolean stoppedByLifeCycle = true; private boolean stoppedByLifeCycle = true;
private boolean enabled = true; private boolean enabled = true;


public EnableableLifeCycle( Log debugLog ) public SuspendableLifeCycle( Log debugLog )
{ {
this.debugLog = debugLog; this.debugLog = debugLog;
} }
Expand Down
Expand Up @@ -30,7 +30,7 @@
import java.net.BindException; import java.net.BindException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;


import org.neo4j.causalclustering.helper.EnableableLifeCycle; import org.neo4j.causalclustering.helper.SuspendableLifeCycle;
import org.neo4j.helpers.ListenSocketAddress; import org.neo4j.helpers.ListenSocketAddress;
import org.neo4j.helpers.NamedThreadFactory; import org.neo4j.helpers.NamedThreadFactory;
import org.neo4j.logging.Log; import org.neo4j.logging.Log;
Expand All @@ -39,7 +39,7 @@


import static java.lang.String.format; import static java.lang.String.format;


public class Server extends EnableableLifeCycle public class Server extends SuspendableLifeCycle
{ {
private final Log debugLog; private final Log debugLog;
private final Log userLog; private final Log userLog;
Expand Down
Expand Up @@ -61,7 +61,7 @@
import org.neo4j.causalclustering.handlers.DuplexPipelineWrapperFactory; import org.neo4j.causalclustering.handlers.DuplexPipelineWrapperFactory;
import org.neo4j.causalclustering.handlers.PipelineWrapper; import org.neo4j.causalclustering.handlers.PipelineWrapper;
import org.neo4j.causalclustering.handlers.VoidPipelineWrapperFactory; import org.neo4j.causalclustering.handlers.VoidPipelineWrapperFactory;
import org.neo4j.causalclustering.helper.CompositeEnableable; import org.neo4j.causalclustering.helper.CompositeSuspendable;
import org.neo4j.causalclustering.helper.ExponentialBackoffStrategy; import org.neo4j.causalclustering.helper.ExponentialBackoffStrategy;
import org.neo4j.causalclustering.identity.MemberId; import org.neo4j.causalclustering.identity.MemberId;
import org.neo4j.causalclustering.net.InstalledProtocolHandler; import org.neo4j.causalclustering.net.InstalledProtocolHandler;
Expand Down Expand Up @@ -286,7 +286,7 @@ public EnterpriseReadReplicaEditionModule( final PlatformModule platformModule,


txPulling.add( copiedStoreRecovery ); txPulling.add( copiedStoreRecovery );


CompositeEnableable servicesToStopOnStoreCopy = new CompositeEnableable(); CompositeSuspendable servicesToStopOnStoreCopy = new CompositeSuspendable();


StoreCopyProcess storeCopyProcess = new StoreCopyProcess( fileSystem, pageCache, localDatabase, StoreCopyProcess storeCopyProcess = new StoreCopyProcess( fileSystem, pageCache, localDatabase,
copiedStoreRecovery, remoteStore, logProvider ); copiedStoreRecovery, remoteStore, logProvider );
Expand Down
Expand Up @@ -36,15 +36,13 @@
import org.neo4j.causalclustering.core.consensus.schedule.CountingTimerService; import org.neo4j.causalclustering.core.consensus.schedule.CountingTimerService;
import org.neo4j.causalclustering.core.consensus.schedule.Timer; import org.neo4j.causalclustering.core.consensus.schedule.Timer;
import org.neo4j.causalclustering.discovery.TopologyService; import org.neo4j.causalclustering.discovery.TopologyService;
import org.neo4j.causalclustering.helper.CompositeEnableable; import org.neo4j.causalclustering.helper.Suspendable;
import org.neo4j.causalclustering.helper.Enableable;
import org.neo4j.causalclustering.identity.MemberId; import org.neo4j.causalclustering.identity.MemberId;
import org.neo4j.causalclustering.identity.StoreId; import org.neo4j.causalclustering.identity.StoreId;
import org.neo4j.causalclustering.upstream.UpstreamDatabaseStrategySelector; import org.neo4j.causalclustering.upstream.UpstreamDatabaseStrategySelector;
import org.neo4j.helpers.AdvertisedSocketAddress; import org.neo4j.helpers.AdvertisedSocketAddress;
import org.neo4j.kernel.impl.transaction.log.TransactionIdStore; import org.neo4j.kernel.impl.transaction.log.TransactionIdStore;
import org.neo4j.kernel.internal.DatabaseHealth; import org.neo4j.kernel.internal.DatabaseHealth;
import org.neo4j.kernel.lifecycle.Lifecycle;
import org.neo4j.kernel.monitoring.Monitors; import org.neo4j.kernel.monitoring.Monitors;
import org.neo4j.logging.NullLogProvider; import org.neo4j.logging.NullLogProvider;
import org.neo4j.test.FakeClockJobScheduler; import org.neo4j.test.FakeClockJobScheduler;
Expand Down Expand Up @@ -91,7 +89,7 @@ public class CatchupPollingProcessTest
when( topologyService.findCatchupAddress( coreMemberId ) ).thenReturn( Optional.of( coreMemberAddress ) ); when( topologyService.findCatchupAddress( coreMemberId ) ).thenReturn( Optional.of( coreMemberAddress ) );
} }


private final Enableable startStopOnStoreCopy = mock( Enableable.class ); private final Suspendable startStopOnStoreCopy = mock( Suspendable.class );


private final CatchupPollingProcess txPuller = private final CatchupPollingProcess txPuller =
new CatchupPollingProcess( NullLogProvider.getInstance(), localDatabase, startStopOnStoreCopy, catchUpClient, strategyPipeline, timerService, new CatchupPollingProcess( NullLogProvider.getInstance(), localDatabase, startStopOnStoreCopy, catchUpClient, strategyPipeline, timerService,
Expand Down
Expand Up @@ -35,7 +35,7 @@
import org.neo4j.causalclustering.core.state.CoreSnapshotService; import org.neo4j.causalclustering.core.state.CoreSnapshotService;
import org.neo4j.causalclustering.core.state.machines.CoreStateMachines; import org.neo4j.causalclustering.core.state.machines.CoreStateMachines;
import org.neo4j.causalclustering.discovery.TopologyService; import org.neo4j.causalclustering.discovery.TopologyService;
import org.neo4j.causalclustering.helper.Enableable; import org.neo4j.causalclustering.helper.Suspendable;
import org.neo4j.causalclustering.identity.MemberId; import org.neo4j.causalclustering.identity.MemberId;
import org.neo4j.causalclustering.identity.StoreId; import org.neo4j.causalclustering.identity.StoreId;
import org.neo4j.helpers.AdvertisedSocketAddress; import org.neo4j.helpers.AdvertisedSocketAddress;
Expand All @@ -54,7 +54,7 @@
public class CoreStateDownloaderTest public class CoreStateDownloaderTest
{ {
private final LocalDatabase localDatabase = mock( LocalDatabase.class ); private final LocalDatabase localDatabase = mock( LocalDatabase.class );
private final Enableable startStopLife = mock( Enableable.class ); private final Suspendable startStopLife = mock( Suspendable.class );
private final RemoteStore remoteStore = mock( RemoteStore.class ); private final RemoteStore remoteStore = mock( RemoteStore.class );
private final CatchUpClient catchUpClient = mock( CatchUpClient.class ); private final CatchUpClient catchUpClient = mock( CatchUpClient.class );
private final StoreCopyProcess storeCopyProcess = mock( StoreCopyProcess.class ); private final StoreCopyProcess storeCopyProcess = mock( StoreCopyProcess.class );
Expand Down
Expand Up @@ -21,9 +21,9 @@


import org.neo4j.logging.NullLog; import org.neo4j.logging.NullLog;


public class CountingThrowingEnableableLifeCycle extends EnableableLifeCycle public class CountingThrowingSuspendableLifeCycle extends SuspendableLifeCycle
{ {
public CountingThrowingEnableableLifeCycle() public CountingThrowingSuspendableLifeCycle()
{ {
super( NullLog.getInstance() ); super( NullLog.getInstance() );
} }
Expand Down
Expand Up @@ -19,14 +19,14 @@
*/ */
package org.neo4j.causalclustering.helper; package org.neo4j.causalclustering.helper;


import org.neo4j.causalclustering.helper.EnableableLifecycleStateTestHelpers.LifeCycleState; import org.neo4j.causalclustering.helper.SuspendableLifecycleStateTestHelpers.LifeCycleState;
import org.neo4j.logging.Log; import org.neo4j.logging.Log;


public class StateAwareEnableableLifeCycle extends EnableableLifeCycle public class StateAwareSuspendableLifeCycle extends SuspendableLifeCycle
{ {
public LifeCycleState status; public LifeCycleState status;


StateAwareEnableableLifeCycle( Log debugLog ) StateAwareSuspendableLifeCycle( Log debugLog )
{ {
super( debugLog ); super( debugLog );
} }
Expand Down
Expand Up @@ -27,15 +27,15 @@
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;


public class EnableableLifeCycleFailingTest public class SuspendableLifeCycleFailingTest
{ {


private CountingThrowingEnableableLifeCycle lifeCycle; private CountingThrowingSuspendableLifeCycle lifeCycle;


@Before @Before
public void setup() throws Throwable public void setup() throws Throwable
{ {
lifeCycle = new CountingThrowingEnableableLifeCycle(); lifeCycle = new CountingThrowingSuspendableLifeCycle();
lifeCycle.init(); lifeCycle.init();
} }


Expand All @@ -45,7 +45,7 @@ public void canEnableIfStopFailed() throws Throwable
lifeCycle.start(); lifeCycle.start();
lifeCycle.setFailMode(); lifeCycle.setFailMode();


runFailing( EnableableLifeCycle::stop ); runFailing( SuspendableLifeCycle::stop );


lifeCycle.setSuccessMode(); lifeCycle.setSuccessMode();


Expand All @@ -60,7 +60,7 @@ public void canEnableIfShutdownFailed() throws Throwable
lifeCycle.start(); lifeCycle.start();
lifeCycle.setFailMode(); lifeCycle.setFailMode();


runFailing( EnableableLifeCycle::shutdown ); runFailing( SuspendableLifeCycle::shutdown );


lifeCycle.setSuccessMode(); lifeCycle.setSuccessMode();


Expand All @@ -73,15 +73,15 @@ public void canEnableIfShutdownFailed() throws Throwable
public void canStartifDisableFailed() throws Throwable public void canStartifDisableFailed() throws Throwable
{ {
lifeCycle.setFailMode(); lifeCycle.setFailMode();
runFailing( EnableableLifeCycle::disable ); runFailing( SuspendableLifeCycle::disable );


lifeCycle.setSuccessMode(); lifeCycle.setSuccessMode();
lifeCycle.start(); lifeCycle.start();


assertEquals( 1, lifeCycle.starts ); assertEquals( 1, lifeCycle.starts );
} }


private void runFailing( ThrowingConsumer<EnableableLifeCycle,Throwable> consumer ) throws Throwable private void runFailing( ThrowingConsumer<SuspendableLifeCycle,Throwable> consumer ) throws Throwable
{ {
try try
{ {
Expand Down

0 comments on commit 95d60bc

Please sign in to comment.