Class WaitNotifyProtocol.Signal
java.lang.Object
org.apache.nifi.processors.standard.WaitNotifyProtocol.Signal
- Enclosing class:
WaitNotifyProtocol
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate AtomicCacheEntry
<String, String, Object> private String
private long
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlong
long
long
boolean
isCountReached
(String counterName, long targetCount) boolean
isTotalCountReached
(long targetCount) <E> void
releaseCandidates
(String counterName, long requiredCountForPass, int releasableCandidateCountPerPass, List<E> candidates, Consumer<List<E>> released, Consumer<List<E>> waiting) Consume accumulated notification signals to let some waiting candidates get released.void
setAttributes
(Map<String, String> attributes) void
void
setReleasableCount
(long releasableCount)
-
Field Details
-
identifier
-
cachedEntry
-
counts
-
attributes
-
releasableCount
private long releasableCount
-
-
Constructor Details
-
Signal
public Signal()
-
-
Method Details
-
getCounts
-
setCounts
-
getAttributes
-
setAttributes
-
getTotalCount
public long getTotalCount() -
isTotalCountReached
public boolean isTotalCountReached(long targetCount) -
isCountReached
-
getCount
-
getReleasableCount
public long getReleasableCount() -
setReleasableCount
public void setReleasableCount(long releasableCount) -
releaseCandidates
public <E> void releaseCandidates(String counterName, long requiredCountForPass, int releasableCandidateCountPerPass, List<E> candidates, Consumer<List<E>> released, Consumer<List<E>> waiting) Consume accumulated notification signals to let some waiting candidates get released.
This method updates state of this instance, but does not update cache storage. Caller of this method is responsible for updating cache storage after processing released and waiting candidates by calling
WaitNotifyProtocol.replace(Signal)
. Caller should rollback what it processed with these candidates if complete call failed.- Type Parameters:
E
- Type of candidate- Parameters:
counterName
- signal counter name to consume from. If not specified, total counter is used, and 'consumed' counter is added to subtract consumed counters from total counter.requiredCountForPass
- number of required signals to acquire a pass.releasableCandidateCountPerPass
- number of releasable candidate per pass.candidates
- candidates waiting for being allowed to pass.released
- function to process allowed candidates to pass.waiting
- function to process candidates those should remain in waiting queue.
-