SimpleSlot extends Slot { @Override public void releaseSlot() { if (!isCanceled()) { Execution exec = this.executedTask; if (exec != null && !exec.isFinished()) { exec.fail(new Exception( "The slot in which the task was executed has been released. Probably loss of TaskManager " + getInstance())); } if (getParent() == null) { if (markCancelled()) { getInstance().returnAllocatedSlot(this); } } else { getParent().releaseChild(this); } } } SimpleSlot(JobID jobID, Instance instance, int slotNumber);  SimpleSlot(JobID jobID, Instance instance, int slotNumber, SharedSlot parent, AbstractID groupID); @Override int getNumberLeaves(); Execution getExecutedVertex(); boolean setExecutedVertex(Execution executedVertex); Locality getLocality(); void setLocality(Locality locality); @Override void releaseSlot(); @Override String toString();  }
@Test public void testStateTransitions() { try { { SimpleSlot slot = getSlot(); assertTrue(slot.isAlive()); slot.releaseSlot(); assertFalse(slot.isAlive()); assertTrue(slot.isCanceled()); assertTrue(slot.isReleased()); } { SimpleSlot slot = getSlot(); assertTrue(slot.isAlive()); slot.markCancelled(); assertFalse(slot.isAlive()); assertTrue(slot.isCanceled()); assertFalse(slot.isReleased()); slot.markReleased(); assertFalse(slot.isAlive()); assertTrue(slot.isCanceled()); assertTrue(slot.isReleased()); } } catch (Exception e) { e.printStackTrace(); fail(e.getMessage()); } }