public class SingleLogicalSlot extends Object implements LogicalSlot, PhysicalSlot.Payload
LogicalSlot
which is used by the SlotPoolImpl
.LogicalSlot.Payload
TERMINATED_PAYLOAD
Constructor and Description |
---|
SingleLogicalSlot(SlotRequestId slotRequestId,
SlotContext slotContext,
SlotSharingGroupId slotSharingGroupId,
Locality locality,
SlotOwner slotOwner) |
SingleLogicalSlot(SlotRequestId slotRequestId,
SlotContext slotContext,
SlotSharingGroupId slotSharingGroupId,
Locality locality,
SlotOwner slotOwner,
boolean willBeOccupiedIndefinitely) |
Modifier and Type | Method and 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.
|
int |
getPhysicalSlotNumber()
Gets the slot number on the TaskManager.
|
SlotRequestId |
getSlotRequestId()
Gets the slot request id uniquely identifying the request with which this slot has been
allocated.
|
SlotSharingGroupId |
getSlotSharingGroupId()
Gets the slot sharing group id to which this slot belongs.
|
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 the
AllocatedSlot 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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
releaseSlot
@VisibleForTesting public SingleLogicalSlot(SlotRequestId slotRequestId, SlotContext slotContext, @Nullable SlotSharingGroupId slotSharingGroupId, Locality locality, SlotOwner slotOwner)
public SingleLogicalSlot(SlotRequestId slotRequestId, SlotContext slotContext, @Nullable SlotSharingGroupId slotSharingGroupId, Locality locality, SlotOwner slotOwner, boolean willBeOccupiedIndefinitely)
public TaskManagerLocation getTaskManagerLocation()
LogicalSlot
getTaskManagerLocation
in interface LogicalSlot
public TaskManagerGateway getTaskManagerGateway()
LogicalSlot
getTaskManagerGateway
in interface LogicalSlot
public Locality getLocality()
LogicalSlot
getLocality
in interface LogicalSlot
public boolean isAlive()
LogicalSlot
isAlive
in interface LogicalSlot
public boolean tryAssignPayload(LogicalSlot.Payload payload)
LogicalSlot
tryAssignPayload
in interface LogicalSlot
payload
- to be assigned to this slot.@Nullable public LogicalSlot.Payload getPayload()
LogicalSlot
getPayload
in interface LogicalSlot
public CompletableFuture<?> releaseSlot(@Nullable Throwable cause)
LogicalSlot
releaseSlot
in interface LogicalSlot
cause
- why the slot was released or null if nonepublic int getPhysicalSlotNumber()
LogicalSlot
getPhysicalSlotNumber
in interface LogicalSlot
public AllocationID getAllocationId()
LogicalSlot
getAllocationId
in interface LogicalSlot
public SlotRequestId getSlotRequestId()
LogicalSlot
getSlotRequestId
in interface LogicalSlot
@Nullable public SlotSharingGroupId getSlotSharingGroupId()
LogicalSlot
getSlotSharingGroupId
in interface LogicalSlot
public static SingleLogicalSlot allocateFromPhysicalSlot(SlotRequestId slotRequestId, PhysicalSlot physicalSlot, Locality locality, SlotOwner slotOwner, boolean slotWillBeOccupiedIndefinitely)
public void release(Throwable cause)
AllocatedSlot
triggers a release of the payload of
the logical slot.release
in interface PhysicalSlot.Payload
cause
- of the payload releasepublic boolean willOccupySlotIndefinitely()
PhysicalSlot.Payload
willOccupySlotIndefinitely
in interface PhysicalSlot.Payload
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.