public class SharedSlot extends Slot
SimpleSlot
instances within itself. This allows to
schedule multiple tasks simultaneously to the same resource. Sharing a resource with multiple
tasks is crucial for simple pipelined / streamed execution, where both the sender and the receiver
are typically active at the same time.
IMPORTANT: This class contains no synchronization. Thus, the caller has to guarantee proper
synchronization. In the current implementation, all concurrently modifying operations are
passed through a SlotSharingGroupAssignment
object which is responsible for
synchronization.
Constructor and Description |
---|
SharedSlot(JobID jobID,
Instance instance,
int slotNumber,
SlotSharingGroupAssignment assignmentGroup)
Creates a new shared slot that has no parent (is a root slot) and does not belong to any task group.
|
SharedSlot(JobID jobID,
Instance instance,
int slotNumber,
SlotSharingGroupAssignment assignmentGroup,
SharedSlot parent,
AbstractID groupId)
Creates a new shared slot that has is a sub-slot of the given parent shared slot, and that belongs
to the given task group.
|
Modifier and Type | Method and Description |
---|---|
int |
getNumberLeaves()
Gets the number of simple slots that are at the leaves of the tree of slots.
|
boolean |
hasChildren()
Checks whether this shared slot has any sub slots.
|
boolean |
isRootAndEmpty()
Checks whether this slot is a root slot that has not yet added any child slots.
|
void |
releaseSlot()
This method cancels and releases the slot and all its sub-slots.
|
String |
toString() |
getGroupID, getInstance, getJobID, getParent, getRoot, getRootSlotNumber, getSlotNumber, hierarchy, isAlive, isCanceled, isReleased
public SharedSlot(JobID jobID, Instance instance, int slotNumber, SlotSharingGroupAssignment assignmentGroup)
jobID
- The ID of the job that the slot is created for.instance
- The instance that holds the slot.slotNumber
- The number of the slot.assignmentGroup
- The assignment group that this shared slot belongs to.public SharedSlot(JobID jobID, Instance instance, int slotNumber, SlotSharingGroupAssignment assignmentGroup, SharedSlot parent, AbstractID groupId)
jobID
- The ID of the job that the slot is created for.instance
- The instance that holds the slot.slotNumber
- The number of the slot.assignmentGroup
- The assignment group that this shared slot belongs to.public int getNumberLeaves()
Slot
getNumberLeaves
in class Slot
public boolean isRootAndEmpty()
public boolean hasChildren()
public void releaseSlot()
Slot
Slot.isReleased()
method will return true
.
If this slot is a simple slot, it will be returned to its instance. If it is a shared slot,
it will release all of its sub-slots and release itself.releaseSlot
in class Slot
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.