Class SingleLogicalSlot
java.lang.Object
org.apache.flink.runtime.jobmaster.slotpool.SingleLogicalSlot
- All Implemented Interfaces:
LogicalSlot,PhysicalSlot.Payload
Implementation of the
LogicalSlot.-
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
ConstructorsConstructorDescriptionSingleLogicalSlot(SlotRequestId slotRequestId, SlotContext slotContext, Locality locality, SlotOwner slotOwner) SingleLogicalSlot(SlotRequestId slotRequestId, SlotContext slotContext, Locality locality, SlotOwner slotOwner, boolean willBeOccupiedIndefinitely) -
Method Summary
Modifier and TypeMethodDescriptionstatic SingleLogicalSlotallocateFromPhysicalSlot(SlotRequestId slotRequestId, PhysicalSlot physicalSlot, Locality locality, SlotOwner slotOwner, boolean slotWillBeOccupiedIndefinitely) Gets the allocation id of this slot.Gets the locality of this slot.Returns the set payload or null if none.Gets the slot request id uniquely identifying the request with which this slot has been allocated.Return the TaskManager gateway to talk to the TaskManager.Return the TaskManager location of this slot.booleanisAlive()True if the slot is alive and has not been released.voidA release of the payload by theAllocatedSlottriggers a release of the payload of the logical slot.releaseSlot(Throwable cause) Releases this slot.booleantryAssignPayload(LogicalSlot.Payload payload) Tries to assign a payload to this slot.booleanReturns 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, waitMethods inherited from interface org.apache.flink.runtime.jobmaster.LogicalSlot
releaseSlot
-
Constructor Details
-
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 Details
-
getTaskManagerLocation
Description copied from interface:LogicalSlotReturn the TaskManager location of this slot.- Specified by:
getTaskManagerLocationin interfaceLogicalSlot- Returns:
- TaskManager location of this slot
-
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
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
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
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
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
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
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
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
-