Class SingleLogicalSlot
- java.lang.Object
-
- org.apache.flink.runtime.jobmaster.slotpool.SingleLogicalSlot
-
- All Implemented Interfaces:
LogicalSlot
,PhysicalSlot.Payload
public class SingleLogicalSlot extends Object implements LogicalSlot, PhysicalSlot.Payload
Implementation of theLogicalSlot
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.flink.runtime.jobmaster.LogicalSlot
LogicalSlot.Payload
-
-
Field Summary
-
Fields inherited from interface org.apache.flink.runtime.jobmaster.LogicalSlot
TERMINATED_PAYLOAD
-
-
Constructor Summary
Constructors Constructor Description SingleLogicalSlot(SlotRequestId slotRequestId, SlotContext slotContext, Locality locality, SlotOwner slotOwner)
SingleLogicalSlot(SlotRequestId slotRequestId, SlotContext slotContext, Locality locality, SlotOwner slotOwner, boolean willBeOccupiedIndefinitely)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static SingleLogicalSlot
allocateFromPhysicalSlot(SlotRequestId slotRequestId, PhysicalSlot physicalSlot, Locality locality, SlotOwner slotOwner, boolean slotWillBeOccupiedIndefinitely)
AllocationID
getAllocationId()
Gets the allocation id of this slot.Locality
getLocality()
Gets the locality of this slot.LogicalSlot.Payload
getPayload()
Returns the set payload or null if none.SlotRequestId
getSlotRequestId()
Gets the slot request id uniquely identifying the request with which this slot has been allocated.TaskManagerGateway
getTaskManagerGateway()
Return the TaskManager gateway to talk to the TaskManager.TaskManagerLocation
getTaskManagerLocation()
Return the TaskManager location of this slot.boolean
isAlive()
True if the slot is alive and has not been released.void
release(Throwable cause)
A release of the payload by theAllocatedSlot
triggers a release of the payload of the logical slot.CompletableFuture<?>
releaseSlot(Throwable cause)
Releases this slot.boolean
tryAssignPayload(LogicalSlot.Payload payload)
Tries to assign a payload to this slot.boolean
willOccupySlotIndefinitely()
Returns whether the payload will occupy a physical slot indefinitely.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.flink.runtime.jobmaster.LogicalSlot
releaseSlot
-
-
-
-
Constructor Detail
-
SingleLogicalSlot
@VisibleForTesting public SingleLogicalSlot(SlotRequestId slotRequestId, SlotContext slotContext, Locality locality, SlotOwner slotOwner)
-
SingleLogicalSlot
public SingleLogicalSlot(SlotRequestId slotRequestId, SlotContext slotContext, Locality locality, SlotOwner slotOwner, boolean willBeOccupiedIndefinitely)
-
-
Method Detail
-
getTaskManagerLocation
public TaskManagerLocation getTaskManagerLocation()
Description copied from interface:LogicalSlot
Return the TaskManager location of this slot.- Specified by:
getTaskManagerLocation
in interfaceLogicalSlot
- Returns:
- TaskManager location of this slot
-
getTaskManagerGateway
public TaskManagerGateway getTaskManagerGateway()
Description copied from interface:LogicalSlot
Return the TaskManager gateway to talk to the TaskManager.- Specified by:
getTaskManagerGateway
in interfaceLogicalSlot
- Returns:
- TaskManager gateway to talk to the TaskManager
-
getLocality
public Locality getLocality()
Description copied from interface:LogicalSlot
Gets the locality of this slot.- Specified by:
getLocality
in interfaceLogicalSlot
- Returns:
- locality of this slot
-
isAlive
public boolean isAlive()
Description copied from interface:LogicalSlot
True if the slot is alive and has not been released.- Specified by:
isAlive
in interfaceLogicalSlot
- Returns:
- True if the slot is alive, otherwise false if the slot is released
-
tryAssignPayload
public boolean tryAssignPayload(LogicalSlot.Payload payload)
Description copied from interface:LogicalSlot
Tries to assign a payload to this slot. One can only assign a single payload once.- Specified by:
tryAssignPayload
in interfaceLogicalSlot
- Parameters:
payload
- to be assigned to this slot.- Returns:
- true if the payload could be assigned, otherwise false
-
getPayload
@Nullable public LogicalSlot.Payload getPayload()
Description copied from interface:LogicalSlot
Returns the set payload or null if none.- Specified by:
getPayload
in interfaceLogicalSlot
- Returns:
- Payload of this slot of null if none
-
releaseSlot
public CompletableFuture<?> releaseSlot(@Nullable Throwable cause)
Description copied from interface:LogicalSlot
Releases this slot.- Specified by:
releaseSlot
in interfaceLogicalSlot
- Parameters:
cause
- why the slot was released or null if none- Returns:
- future which is completed once the slot has been released
-
getAllocationId
public AllocationID getAllocationId()
Description copied from interface:LogicalSlot
Gets the allocation id of this slot. Multiple logical slots can share the same allocation id.- Specified by:
getAllocationId
in interfaceLogicalSlot
- Returns:
- allocation id of this slot
-
getSlotRequestId
public SlotRequestId getSlotRequestId()
Description copied from interface:LogicalSlot
Gets the slot request id uniquely identifying the request with which this slot has been allocated.- Specified by:
getSlotRequestId
in interfaceLogicalSlot
- Returns:
- Unique id identifying the slot request with which this slot was allocated
-
allocateFromPhysicalSlot
public static SingleLogicalSlot allocateFromPhysicalSlot(SlotRequestId slotRequestId, PhysicalSlot physicalSlot, Locality locality, SlotOwner slotOwner, boolean slotWillBeOccupiedIndefinitely)
-
release
public void release(Throwable cause)
A release of the payload by theAllocatedSlot
triggers a release of the payload of the logical slot.- Specified by:
release
in interfacePhysicalSlot.Payload
- Parameters:
cause
- of the payload release
-
willOccupySlotIndefinitely
public boolean willOccupySlotIndefinitely()
Description copied from interface:PhysicalSlot.Payload
Returns whether the payload will occupy a physical slot indefinitely.- Specified by:
willOccupySlotIndefinitely
in interfacePhysicalSlot.Payload
- Returns:
- true if the payload will occupy a physical slot indefinitely, otherwise false
-
-