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 SingleLogicalSlotallocateFromPhysicalSlot(SlotRequestId slotRequestId, PhysicalSlot physicalSlot, Locality locality, SlotOwner slotOwner, boolean slotWillBeOccupiedIndefinitely)AllocationIDgetAllocationId()Gets the allocation id of this slot.LocalitygetLocality()Gets the locality of this slot.LogicalSlot.PayloadgetPayload()Returns the set payload or null if none.SlotRequestIdgetSlotRequestId()Gets the slot request id uniquely identifying the request with which this slot has been allocated.TaskManagerGatewaygetTaskManagerGateway()Return the TaskManager gateway to talk to the TaskManager.TaskManagerLocationgetTaskManagerLocation()Return the TaskManager location of this slot.booleanisAlive()True if the slot is alive and has not been released.voidrelease(Throwable cause)A release of the payload by theAllocatedSlottriggers a release of the payload of the logical slot.CompletableFuture<?>releaseSlot(Throwable cause)Releases this slot.booleantryAssignPayload(LogicalSlot.Payload payload)Tries to assign a payload to this slot.booleanwillOccupySlotIndefinitely()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:LogicalSlotReturn the TaskManager location of this slot.- Specified by:
getTaskManagerLocationin interfaceLogicalSlot- Returns:
- TaskManager location of this slot
-
getTaskManagerGateway
public TaskManagerGateway getTaskManagerGateway()
Description copied from interface:LogicalSlotReturn the TaskManager gateway to talk to the TaskManager.- Specified by:
getTaskManagerGatewayin interfaceLogicalSlot- Returns:
- TaskManager gateway to talk to the TaskManager
-
getLocality
public Locality getLocality()
Description copied from interface:LogicalSlotGets the locality of this slot.- Specified by:
getLocalityin interfaceLogicalSlot- Returns:
- locality of this slot
-
isAlive
public boolean isAlive()
Description copied from interface:LogicalSlotTrue if the slot is alive and has not been released.- Specified by:
isAlivein 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:LogicalSlotTries to assign a payload to this slot. One can only assign a single payload once.- Specified by:
tryAssignPayloadin 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:LogicalSlotReturns the set payload or null if none.- Specified by:
getPayloadin interfaceLogicalSlot- Returns:
- Payload of this slot of null if none
-
releaseSlot
public CompletableFuture<?> releaseSlot(@Nullable Throwable cause)
Description copied from interface:LogicalSlotReleases this slot.- Specified by:
releaseSlotin 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:LogicalSlotGets the allocation id of this slot. Multiple logical slots can share the same allocation id.- Specified by:
getAllocationIdin interfaceLogicalSlot- Returns:
- allocation id of this slot
-
getSlotRequestId
public SlotRequestId getSlotRequestId()
Description copied from interface:LogicalSlotGets the slot request id uniquely identifying the request with which this slot has been allocated.- Specified by:
getSlotRequestIdin 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 theAllocatedSlottriggers a release of the payload of the logical slot.- Specified by:
releasein interfacePhysicalSlot.Payload- Parameters:
cause- of the payload release
-
willOccupySlotIndefinitely
public boolean willOccupySlotIndefinitely()
Description copied from interface:PhysicalSlot.PayloadReturns whether the payload will occupy a physical slot indefinitely.- Specified by:
willOccupySlotIndefinitelyin interfacePhysicalSlot.Payload- Returns:
- true if the payload will occupy a physical slot indefinitely, otherwise false
-
-