Search in sources :

Example 1 with MapPartitionDestroyTask

use of com.hazelcast.map.impl.operation.MapPartitionDestroyTask in project hazelcast by hazelcast.

the class MapServiceContextImpl method destroyPartitionsAndMapContainer.

private void destroyPartitionsAndMapContainer(MapContainer mapContainer) {
    Semaphore semaphore = new Semaphore(0);
    InternalOperationService operationService = (InternalOperationService) nodeEngine.getOperationService();
    for (PartitionContainer container : partitionContainers) {
        MapPartitionDestroyTask partitionDestroyTask = new MapPartitionDestroyTask(container, mapContainer, semaphore);
        operationService.execute(partitionDestroyTask);
    }
    try {
        semaphore.tryAcquire(partitionContainers.length, DESTROY_TIMEOUT_SECONDS, TimeUnit.SECONDS);
    } catch (Throwable t) {
        throw ExceptionUtil.rethrow(t);
    }
}
Also used : MapPartitionDestroyTask(com.hazelcast.map.impl.operation.MapPartitionDestroyTask) Semaphore(java.util.concurrent.Semaphore) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService)

Aggregations

MapPartitionDestroyTask (com.hazelcast.map.impl.operation.MapPartitionDestroyTask)1 InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)1 Semaphore (java.util.concurrent.Semaphore)1