public class ProgressEventDispatcher extends Object implements Closeable
ProgressEvents associated with a managed Allocation. Keeps track of
the allocation units that are remaining so that it can emit the remaining progress units upon
close().
This class is not thread-safe. Only use a single instance per thread and create child
instances with newChildProducer().
| Modifier and Type | Class and Description |
|---|---|
static interface |
ProgressEventDispatcher.Factory
Creates a new
ProgressEventDispatcher based off an existing ProgressEventDispatcher. |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Emits the remaining allocation units as progress units in a
ProgressEvent. |
void |
dispatchProgress(long progressUnits)
|
ProgressEventDispatcher.Factory |
newChildProducer()
Creates a new
ProgressEventDispatcher.Factory for a ProgressEventDispatcher that manages a child Allocation. |
static ProgressEventDispatcher |
newRoot(EventHandlers eventHandlers,
String description,
long allocationUnits)
Creates a new
ProgressEventDispatcher with a root Allocation. |
public static ProgressEventDispatcher newRoot(EventHandlers eventHandlers, String description, long allocationUnits)
ProgressEventDispatcher with a root Allocation.eventHandlers - the EventHandlersdescription - user-facing description of what the allocation representsallocationUnits - number of allocation unitsProgressEventDispatcherpublic ProgressEventDispatcher.Factory newChildProducer()
ProgressEventDispatcher.Factory for a ProgressEventDispatcher that manages a child Allocation. Since each child Allocation accounts for 1 allocation unit of its parent,
this method decrements the remainingAllocationUnits by 1.ProgressEventDispatcher.Factorypublic void close()
ProgressEvent.close in interface Closeableclose in interface AutoCloseablepublic void dispatchProgress(long progressUnits)
progressUnits - units of progressCopyright © 2019. All rights reserved.