@Override
    public boolean tryMarkSlotActive(JobID jobId, AllocationID allocationId) {
        TaskSlot<T> taskSlot = getTaskSlot(allocationId);

        if (taskSlot != null && taskSlot.isAllocated(jobId, allocationId)) {
            return markExistingSlotActive(taskSlot);
        } else {
            return false;
        }
    }
@Test
    void testTryMarkSlotActive() throws Exception {
        final TaskSlotTableImpl<?> taskSlotTable = createTaskSlotTableAndStart(3);

        try {
            final JobID jobId1 = new JobID();
            final AllocationID allocationId1 = new AllocationID();
            taskSlotTable.allocateSlot(0, jobId1, allocationId1, SLOT_TIMEOUT);
            final AllocationID allocationId2 = new AllocationID();
            taskSlotTable.allocateSlot(1, jobId1, allocationId2, SLOT_TIMEOUT);
            final AllocationID allocationId3 = new AllocationID();
            final JobID jobId2 = new JobID();
            taskSlotTable.allocateSlot(2, jobId2, allocationId3, SLOT_TIMEOUT);

            taskSlotTable.markSlotActive(allocationId1);

            assertThat(taskSlotTable.isAllocated(0, jobId1, allocationId1)).isTrue();
            assertThat(taskSlotTable.isAllocated(1, jobId1, allocationId2)).isTrue();
            assertThat(taskSlotTable.isAllocated(2, jobId2, allocationId3)).isTrue();

            assertThat(taskSlotTable.getActiveTaskSlotAllocationIdsPerJob(jobId1))
                    .isEqualTo(Sets.newHashSet(allocationId1));

            assertThat(taskSlotTable.tryMarkSlotActive(jobId1, allocationId1)).isTrue();
            assertThat(taskSlotTable.tryMarkSlotActive(jobId1, allocationId2)).isTrue();
            assertThat(taskSlotTable.tryMarkSlotActive(jobId1, allocationId3)).isFalse();

            assertThat(taskSlotTable.getActiveTaskSlotAllocationIdsPerJob(jobId1))
                    .isEqualTo(new HashSet<>(Arrays.asList(allocationId2, allocationId1)));
        } finally {
            taskSlotTable.close();
            assertThat(taskSlotTable.isClosed()).isTrue();
        }
    }