use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class PartitionCorrectnessTestSupport method fillData.
void fillData(HazelcastInstance hz) {
NodeEngine nodeEngine = getNode(hz).nodeEngine;
OperationService operationService = nodeEngine.getOperationService();
for (int i = 0; i < partitionCount; i++) {
operationService.invokeOnPartition(null, new TestIncrementOperation(), i);
for (String name : NAMESPACES) {
operationService.invokeOnPartition(null, new TestFragmentIncrementOperation(name), i);
}
}
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class AbstractGracefulShutdownCorrectnessTest method testPartitionData_whenNodesStartedShutdown_whileOperationsOngoing.
@Test(timeout = 6000 * 10 * 10)
public void testPartitionData_whenNodesStartedShutdown_whileOperationsOngoing() throws InterruptedException {
final Config config = getConfig(true, false);
Future future = spawn(() -> {
LinkedList<HazelcastInstance> instances = new LinkedList<>(Arrays.asList(factory.newInstances(config, nodeCount)));
try {
for (int i = 0; i < 3; i++) {
shutdownNodes(instances, shutdownNodeCount);
Collection<HazelcastInstance> startedInstances = startNodes(config, shutdownNodeCount);
instances.addAll(startedInstances);
}
shutdownNodes(instances, shutdownNodeCount);
} catch (InterruptedException e) {
e.printStackTrace();
}
});
HazelcastInstance hz = factory.newHazelcastInstance(config);
NodeEngine nodeEngine = getNodeEngineImpl(hz);
while (!nodeEngine.getClusterService().isJoined()) {
TimeUnit.MILLISECONDS.sleep(100);
}
OperationService operationService = nodeEngine.getOperationService();
int partitionCount = nodeEngine.getPartitionService().getPartitionCount();
int value = 0;
do {
value++;
for (int p = 0; p < partitionCount; p++) {
operationService.invokeOnPartition(null, new TestPutOperation(value), p).join();
}
} while (!future.isDone());
for (int p = 0; p < partitionCount; p++) {
Integer actual = (Integer) operationService.invokeOnPartition(null, new TestGetOperation(), p).join();
assertNotNull(actual);
assertEquals(value, actual.intValue());
}
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class InternalPartitionServiceStackOverflowTest method test.
public void test(int partitionId) {
HazelcastInstance hz = createHazelcastInstance();
OperationService opService = getNode(hz).nodeEngine.getOperationService();
int iterations = 2000;
final CountDownLatch latch = new CountDownLatch(iterations);
for (int k = 0; k < iterations; k++) {
Operation op;
if (partitionId >= 0) {
op = new SlowPartitionAwareSystemOperation(latch, partitionId);
} else {
op = new SlowPartitionUnawareSystemOperation(latch);
}
op.setOperationResponseHandler(OperationResponseHandlerFactory.createEmptyResponseHandler());
opService.execute(op);
}
assertTrueEventually(new AssertTask() {
@Override
public void run() {
assertEquals(0, latch.getCount());
}
});
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class MapIndexLifecycleTest method numberOfPartitionQueryResults.
private int numberOfPartitionQueryResults(HazelcastInstance instance, int partitionId, String attribute, Comparable value) {
OperationService operationService = getOperationService(instance);
Query query = Query.of().mapName(mapName).iterationType(IterationType.KEY).predicate(Predicates.equal(attribute, value)).build();
Operation queryOperation = getMapOperationProvider(instance, mapName).createQueryPartitionOperation(query);
InternalCompletableFuture<QueryResult> future = operationService.invokeOnPartition(MapService.SERVICE_NAME, queryOperation, partitionId);
return future.join().size();
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class RingbufferProxy method readManyAsync.
@Override
public CompletionStage<ReadResultSet<E>> readManyAsync(long startSequence, int minCount, int maxCount, @Nullable IFunction<E, Boolean> filter) {
checkSequence(startSequence);
checkNotNegative(minCount, "minCount can't be smaller than 0");
checkTrue(maxCount >= minCount, "maxCount should be equal or larger than minCount");
checkTrue(maxCount <= config.getCapacity(), "the maxCount should be smaller than or equal to the capacity");
checkTrue(maxCount <= MAX_BATCH_SIZE, "maxCount can't be larger than " + MAX_BATCH_SIZE);
Operation op = new ReadManyOperation<>(name, startSequence, minCount, maxCount, filter).setPartitionId(partitionId);
OperationService operationService = getOperationService();
return operationService.createInvocationBuilder(null, op, partitionId).setCallTimeout(Long.MAX_VALUE).invoke();
}
Aggregations