public class Instance extends Object
TaskManager runs on.| Constructor and Description |
|---|
Instance(InstanceConnectionInfo instanceConnectionInfo,
InstanceID id,
HardwareDescription resources,
int numberOfSlots)
Constructs an abstract instance object.
|
| Modifier and Type | Method and Description |
|---|---|
AllocatedSlot |
allocateSlot(JobID jobID) |
void |
cancelAndReleaseAllSlots() |
InstanceID |
getId() |
InstanceConnectionInfo |
getInstanceConnectionInfo()
Returns the instance's connection information object.
|
long |
getLastHeartBeat()
Gets the timestamp of the last heartbeat.
|
int |
getNumberOfAllocatedSlots() |
int |
getNumberOfAvailableSlots() |
HardwareDescription |
getResources() |
TaskOperationProtocol |
getTaskManagerProxy() |
int |
getTotalNumberOfSlots() |
boolean |
hasResourcesAvailable() |
boolean |
isAlive() |
boolean |
isStillAlive(long now,
long cleanUpInterval)
Checks whether the last heartbeat occurred within the last
n milliseconds
before the given timestamp now. |
void |
markDead() |
void |
removeSlotListener() |
void |
reportHeartBeat()
Updates the time of last received heart beat to the current system time.
|
boolean |
returnAllocatedSlot(AllocatedSlot slot) |
void |
setSlotAvailabilityListener(SlotAvailabilityListener slotAvailabilityListener) |
void |
stopInstance() |
String |
toString() |
public Instance(InstanceConnectionInfo instanceConnectionInfo, InstanceID id, HardwareDescription resources, int numberOfSlots)
instanceConnectionInfo - The connection info under which to reach the TaskManager instance.id - The id under which the instance is registered.resources - The resources available on the machine.numberOfSlots - The number of task slots offered by this instance.public InstanceID getId()
public HardwareDescription getResources()
public int getTotalNumberOfSlots()
public InstanceConnectionInfo getInstanceConnectionInfo()
public boolean isAlive()
public void stopInstance()
public void markDead()
public TaskOperationProtocol getTaskManagerProxy() throws IOException
IOExceptionpublic long getLastHeartBeat()
public void reportHeartBeat()
public boolean isStillAlive(long now,
long cleanUpInterval)
n milliseconds
before the given timestamp now.now - The timestamp representing the current time.cleanUpInterval - The maximum time (in msecs) that the last heartbeat may lie in the past.public AllocatedSlot allocateSlot(JobID jobID) throws InstanceDiedException
InstanceDiedExceptionpublic boolean returnAllocatedSlot(AllocatedSlot slot)
public void cancelAndReleaseAllSlots()
public int getNumberOfAvailableSlots()
public int getNumberOfAllocatedSlots()
public boolean hasResourcesAvailable()
public void setSlotAvailabilityListener(SlotAvailabilityListener slotAvailabilityListener)
public void removeSlotListener()
Copyright © 2015 The Apache Software Foundation. All rights reserved.