use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class RingbufferProxy method addAllAsync.
@Override
public ICompletableFuture<Long> addAllAsync(Collection<? extends E> collection, OverflowPolicy overflowPolicy) {
checkNotNull(collection, "collection can't be null");
checkNotNull(overflowPolicy, "overflowPolicy can't be null");
checkFalse(collection.isEmpty(), "collection can't be empty");
checkTrue(collection.size() <= MAX_BATCH_SIZE, "collection can't be larger than " + MAX_BATCH_SIZE);
Operation op = new AddAllOperation(name, toDataArray(collection), overflowPolicy).setPartitionId(partitionId);
OperationService operationService = getOperationService();
return operationService.createInvocationBuilder(null, op, partitionId).setCallTimeout(Long.MAX_VALUE).invoke();
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class RequestMapDataOperation method run.
@Override
public void run() throws Exception {
ILogger logger = getLogger();
int partitionId = getPartitionId();
Address callerAddress = getCallerAddress();
if (logger.isFineEnabled()) {
logger.fine("Caller { " + callerAddress + " } requested copy of map: " + name + " partitionId=" + partitionId);
}
ReplicatedMapService service = getService();
PartitionContainer container = service.getPartitionContainer(partitionId);
ReplicatedRecordStore store = container.getOrCreateRecordStore(name);
store.setLoaded(true);
if (getNodeEngine().getThisAddress().equals(callerAddress)) {
return;
}
long version = store.getVersion();
Set<RecordMigrationInfo> recordSet = getRecordSet(store);
SyncReplicatedMapDataOperation op = new SyncReplicatedMapDataOperation(name, recordSet, version);
op.setPartitionId(partitionId);
op.setValidateTarget(false);
OperationService operationService = getNodeEngine().getOperationService();
operationService.createInvocationBuilder(SERVICE_NAME, op, callerAddress).setTryCount(INVOCATION_TRY_COUNT).invoke();
}
use of com.hazelcast.spi.OperationService 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);
}
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class ReplicatedMapProxy method requestDataForPartition.
private void requestDataForPartition(int partitionId) {
RequestMapDataOperation requestMapDataOperation = new RequestMapDataOperation(name);
OperationService operationService = nodeEngine.getOperationService();
operationService.createInvocationBuilder(SERVICE_NAME, requestMapDataOperation, partitionId).setTryCount(ReplicatedMapService.INVOCATION_TRY_COUNT).invoke();
}
use of com.hazelcast.spi.OperationService in project hazelcast by hazelcast.
the class CheckReplicaVersionOperation method requestDataFromOwner.
private void requestDataFromOwner(String name) {
OperationService operationService = getNodeEngine().getOperationService();
RequestMapDataOperation requestMapDataOperation = new RequestMapDataOperation(name);
operationService.createInvocationBuilder(SERVICE_NAME, requestMapDataOperation, getPartitionId()).setTryCount(INVOCATION_TRY_COUNT).invoke();
}
Aggregations