use of com.hazelcast.spi.impl.BinaryOperationFactory in project hazelcast by hazelcast.
the class MapProxySupport method clearInternal.
public void clearInternal() {
try {
Operation clearOperation = operationProvider.createClearOperation(name);
clearOperation.setServiceName(SERVICE_NAME);
BinaryOperationFactory factory = new BinaryOperationFactory(clearOperation, getNodeEngine());
Map<Integer, Object> resultMap = operationService.invokeOnAllPartitions(SERVICE_NAME, factory);
int clearedCount = 0;
for (Object object : resultMap.values()) {
clearedCount += (Integer) object;
}
if (clearedCount > 0) {
publishMapEvent(clearedCount, CLEAR_ALL);
}
} catch (Throwable t) {
throw rethrow(t);
}
}
use of com.hazelcast.spi.impl.BinaryOperationFactory in project hazelcast by hazelcast.
the class MapProxySupport method addIndex.
public void addIndex(String attribute, boolean ordered) {
validateIndexAttribute(attribute);
try {
AddIndexOperation addIndexOperation = new AddIndexOperation(name, attribute, ordered);
operationService.invokeOnAllPartitions(SERVICE_NAME, new BinaryOperationFactory(addIndexOperation, getNodeEngine()));
} catch (Throwable t) {
throw rethrow(t);
}
}
use of com.hazelcast.spi.impl.BinaryOperationFactory in project hazelcast by hazelcast.
the class MapProxySupport method evictAllInternal.
protected void evictAllInternal() {
try {
Operation operation = operationProvider.createEvictAllOperation(name);
BinaryOperationFactory factory = new BinaryOperationFactory(operation, getNodeEngine());
Map<Integer, Object> resultMap = operationService.invokeOnAllPartitions(SERVICE_NAME, factory);
int evictedCount = 0;
for (Object object : resultMap.values()) {
evictedCount += (Integer) object;
}
if (evictedCount > 0) {
publishMapEvent(evictedCount, EntryEventType.EVICT_ALL);
}
} catch (Throwable t) {
throw rethrow(t);
}
}
use of com.hazelcast.spi.impl.BinaryOperationFactory in project hazelcast by hazelcast.
the class MapProxySupport method flush.
// TODO: add a feature to mancenter to sync cache to db completely
public void flush() {
try {
MapOperation mapFlushOperation = operationProvider.createMapFlushOperation(name);
BinaryOperationFactory operationFactory = new BinaryOperationFactory(mapFlushOperation, getNodeEngine());
Map<Integer, Object> results = operationService.invokeOnAllPartitions(SERVICE_NAME, operationFactory);
List<Future> futures = new ArrayList<Future>();
for (Entry<Integer, Object> entry : results.entrySet()) {
Integer partitionId = entry.getKey();
Long count = ((Long) entry.getValue());
if (count != 0) {
Operation operation = new AwaitMapFlushOperation(name, count);
futures.add(operationService.invokeOnPartition(MapService.SERVICE_NAME, operation, partitionId));
}
}
for (Future future : futures) {
future.get();
}
} catch (Throwable t) {
throw rethrow(t);
}
}
Aggregations