/** * Allocates a simple slot on this TaskManager instance. This method returns {@code null}, if no slot * is available at the moment. * * @return A simple slot that represents a task slot on this TaskManager instance, or null, if the * TaskManager instance has no more slots available. * * @throws InstanceDiedException Thrown if the instance is no longer alive by the time the * slot is allocated. */ public SimpleSlot allocateSimpleSlot() throws InstanceDiedException { synchronized (instanceLock) { if (isDead) { throw new InstanceDiedException(this); } Integer nextSlot = availableSlots.poll(); if (nextSlot == null) { return null; } else { SimpleSlot slot = new SimpleSlot(this, location, nextSlot, taskManagerGateway); allocatedSlots.add(slot); return slot; } } }
/** * Allocates a simple slot on this TaskManager instance. This method returns {@code null}, if no slot * is available at the moment. * * @return A simple slot that represents a task slot on this TaskManager instance, or null, if the * TaskManager instance has no more slots available. * * @throws InstanceDiedException Thrown if the instance is no longer alive by the time the * slot is allocated. */ public SimpleSlot allocateSimpleSlot() throws InstanceDiedException { synchronized (instanceLock) { if (isDead) { throw new InstanceDiedException(this); } Integer nextSlot = availableSlots.poll(); if (nextSlot == null) { return null; } else { SimpleSlot slot = new SimpleSlot(this, location, nextSlot, taskManagerGateway); allocatedSlots.add(slot); return slot; } } }
SimpleSlot slot = new SimpleSlot(jobID, this, location, nextSlot, taskManagerGateway); allocatedSlots.add(slot); return slot;
/** * Allocates a simple slot on this TaskManager instance. This method returns {@code null}, if no slot * is available at the moment. * * @return A simple slot that represents a task slot on this TaskManager instance, or null, if the * TaskManager instance has no more slots available. * * @throws InstanceDiedException Thrown if the instance is no longer alive by the time the * slot is allocated. */ public SimpleSlot allocateSimpleSlot() throws InstanceDiedException { synchronized (instanceLock) { if (isDead) { throw new InstanceDiedException(this); } Integer nextSlot = availableSlots.poll(); if (nextSlot == null) { return null; } else { SimpleSlot slot = new SimpleSlot(this, location, nextSlot, taskManagerGateway); allocatedSlots.add(slot); return slot; } } }
private SimpleSlot createSimpleSlot(AllocatedSlot slot, Locality locality) { SimpleSlot result = new SimpleSlot(slot, providerAndOwner, slot.getSlotNumber()); if (locality != null) { result.setLocality(locality); } return result; }
/** * Creates a new sub slot if the slot is not dead, yet. This method should only be called from * the assignment group instance to guarantee synchronization. * * <b>NOTE:</b> This method is not synchronized and must only be called from * the slot's assignment group. * * @param groupId The ID to identify tasks which can be deployed in this sub slot. * @return The new sub slot if the shared slot is still alive, otherwise null. */ SimpleSlot allocateSubSlot(AbstractID groupId) { if (isAlive()) { SimpleSlot slot = new SimpleSlot( getOwner(), getTaskManagerLocation(), subSlots.size(), getTaskManagerGateway(), this, groupId); subSlots.add(slot); return slot; } else { return null; } }
/** * Creates a new sub slot if the slot is not dead, yet. This method should only be called from * the assignment group instance to guarantee synchronization. * * <b>NOTE:</b> This method is not synchronized and must only be called from * the slot's assignment group. * * @param groupId The ID to identify tasks which can be deployed in this sub slot. * @return The new sub slot if the shared slot is still alive, otherwise null. */ SimpleSlot allocateSubSlot(AbstractID groupId) { if (isAlive()) { SimpleSlot slot = new SimpleSlot( getJobID(), getOwner(), getTaskManagerLocation(), subSlots.size(), getTaskManagerGateway(), this, groupId); subSlots.add(slot); return slot; } else { return null; } }
/** * Creates a new sub slot if the slot is not dead, yet. This method should only be called from * the assignment group instance to guarantee synchronization. * * <b>NOTE:</b> This method is not synchronized and must only be called from * the slot's assignment group. * * @param groupId The ID to identify tasks which can be deployed in this sub slot. * @return The new sub slot if the shared slot is still alive, otherwise null. */ SimpleSlot allocateSubSlot(AbstractID groupId) { if (isAlive()) { SimpleSlot slot = new SimpleSlot( getOwner(), getTaskManagerLocation(), subSlots.size(), getTaskManagerGateway(), this, groupId); subSlots.add(slot); return slot; } else { return null; } }
/** * Creates a new sub slot if the slot is not dead, yet. This method should only be called from * the assignment group instance to guarantee synchronization. * * <b>NOTE:</b> This method is not synchronized and must only be called from * the slot's assignment group. * * @param groupId The ID to identify tasks which can be deployed in this sub slot. * @return The new sub slot if the shared slot is still alive, otherwise null. */ SimpleSlot allocateSubSlot(AbstractID groupId) { if (isAlive()) { SimpleSlot slot = new SimpleSlot( getOwner(), getTaskManagerLocation(), subSlots.size(), getTaskManagerGateway(), this, groupId); subSlots.add(slot); return slot; } else { return null; } }