public class ParallelCollectorGroup extends Object
Modifier and Type | Field and Description |
---|---|
private boolean |
aborted
Is there an abort request outstanding?
|
private ParallelCollector[] |
contexts
The collector context instances operating within this group
|
private int |
contextsParked
The number of threads that are currently parked
|
private int |
currentRendezvousCounter
Which rendezvous counter is currently in use
|
private Monitor |
lock
Lock used to manage group state.
|
private String |
name
The name of this collector context group.
|
private int[] |
rendezvousCounter
Used to count threads during calls to rendezvous()
|
private int |
triggerCount
The number of cycles triggered
|
Constructor and Description |
---|
ParallelCollectorGroup(String name) |
Modifier and Type | Method and Description |
---|---|
void |
abortCycle()
Signal that you would like the threads to park abruptly.
|
int |
activeWorkerCount() |
void |
initGroup(int size,
Class<? extends ParallelCollector> klass)
Initialize the collector context group.
|
boolean |
isAborted() |
boolean |
isMember(CollectorContext context)
Is the given context and member of this group.
|
void |
park(ParallelCollector context)
Park the given collector in the group.
|
int |
rendezvous()
Rendezvous with other active threads in this group.
|
void |
triggerCycle()
Wake up the parked threads in this group.
|
void |
waitForCycle()
Wait until the group is idle.
|
private ParallelCollector[] contexts
private volatile int triggerCount
private volatile int contextsParked
private volatile boolean aborted
private final int[] rendezvousCounter
private volatile int currentRendezvousCounter
public ParallelCollectorGroup(String name)
name
- human-readable name of the collector grouppublic int activeWorkerCount()
public void initGroup(int size, Class<? extends ParallelCollector> klass)
size
- The number of collector contexts within the group.klass
- The type of collector context to create.public void triggerCycle()
public void abortCycle()
public boolean isAborted()
public void waitForCycle()
public void park(ParallelCollector context)
context
- The context to park.public boolean isMember(CollectorContext context)
context
- The context to pass.true
if the context is a member.public int rendezvous()