Search in sources :

Example 1 with ClearOperationFactory

use of com.hazelcast.replicatedmap.impl.operation.ClearOperationFactory in project hazelcast by hazelcast.

the class ReplicatedMapProxy method clear.

@Override
public void clear() {
    OperationService operationService = nodeEngine.getOperationService();
    try {
        Map<Integer, Object> results = operationService.invokeOnAllPartitions(SERVICE_NAME, new ClearOperationFactory(name));
        int deletedEntrySize = 0;
        for (Object deletedEntryPerPartition : results.values()) {
            deletedEntrySize += (Integer) deletedEntryPerPartition;
        }
        ReplicatedMapEventPublishingService eventPublishingService = service.getEventPublishingService();
        eventPublishingService.fireMapClearedEvent(deletedEntrySize, name);
    } catch (Throwable t) {
        throw rethrow(t);
    }
}
Also used : AbstractDistributedObject(com.hazelcast.spi.AbstractDistributedObject) InitializingObject(com.hazelcast.spi.InitializingObject) OperationService(com.hazelcast.spi.OperationService) ClearOperationFactory(com.hazelcast.replicatedmap.impl.operation.ClearOperationFactory)

Aggregations

ClearOperationFactory (com.hazelcast.replicatedmap.impl.operation.ClearOperationFactory)1 AbstractDistributedObject (com.hazelcast.spi.AbstractDistributedObject)1 InitializingObject (com.hazelcast.spi.InitializingObject)1 OperationService (com.hazelcast.spi.OperationService)1