Class ServiceStateTransition
java.lang.Object
org.apache.nifi.controller.service.ServiceStateTransition
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ControllerServiceNodeprivate final List<CompletableFuture<?>> private final List<CompletableFuture<?>> private static final org.slf4j.Loggerprivate final Lockprivate final ReadWriteLockprivate ControllerServiceStateprivate final Conditionprivate final Lock -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanawaitCondition(BooleanSupplier predicate, long timePeriod, TimeUnit timeUnit, String desiredConditionDescription) Waits up to the specified max amount of time for the given predicate to become true.booleanawaitState(ControllerServiceState desiredState, long timePeriod, TimeUnit timeUnit) booleanawaitStateOrInvalid(ControllerServiceState desiredState, long timePeriod, TimeUnit timeUnit) voiddisable()booleanenable(ControllerServiceReference controllerServiceReference) getState()voidbooleantransitionToDisabling(ControllerServiceState expectedState, CompletableFuture<?> disabledFuture) booleantransitionToEnabling(ControllerServiceState expectedState, CompletableFuture<?> enabledFuture)
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
state
-
enabledFutures
-
disabledFutures
-
controllerServiceNode
-
rwLock
-
writeLock
-
readLock
-
stateChangeCondition
-
-
Constructor Details
-
ServiceStateTransition
-
-
Method Details
-
transitionToEnabling
public boolean transitionToEnabling(ControllerServiceState expectedState, CompletableFuture<?> enabledFuture) -
enable
-
transitionToDisabling
public boolean transitionToDisabling(ControllerServiceState expectedState, CompletableFuture<?> disabledFuture) -
disable
public void disable() -
getState
-
awaitCondition
public boolean awaitCondition(BooleanSupplier predicate, long timePeriod, TimeUnit timeUnit, String desiredConditionDescription) throws InterruptedException Waits up to the specified max amount of time for the given predicate to become true.- Parameters:
predicate- the condition under which the wait should stoptimePeriod- the max period of time to waittimeUnit- the time unit associated with the time period- Returns:
- true if the predicate becomes true before the given time period, false if the time period elapses first
- Throws:
InterruptedException- if interrupted while waiting for the condition to become true
-
awaitState
public boolean awaitState(ControllerServiceState desiredState, long timePeriod, TimeUnit timeUnit) throws InterruptedException - Throws:
InterruptedException
-
awaitStateOrInvalid
public boolean awaitStateOrInvalid(ControllerServiceState desiredState, long timePeriod, TimeUnit timeUnit) throws InterruptedException - Throws:
InterruptedException
-
signalInvalid
public void signalInvalid()
-