use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class CompletableFutureTest method setUp.
@Before
public void setUp() {
NodeEngine nodeEngine = getNode(createHazelcastInstance()).getNodeEngine();
executionService = nodeEngine.getExecutionService();
startLogicLatch = new CountDownLatch(1);
executedLogic = new CountDownLatch(1);
inExecutionLatch = new CountDownLatch(1);
reference1 = new AtomicReference<Object>();
reference2 = new AtomicReference<Object>();
}
use of com.hazelcast.spi.impl.NodeEngine 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.NodeEngine 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.NodeEngine in project hazelcast by hazelcast.
the class CacheClearExpiredOperation method isOwner.
private boolean isOwner() {
final NodeEngine nodeEngine = getNodeEngine();
final Address owner = nodeEngine.getPartitionService().getPartitionOwner(getPartitionId());
return nodeEngine.getThisAddress().equals(owner);
}
use of com.hazelcast.spi.impl.NodeEngine in project hazelcast by hazelcast.
the class CacheOperation method publishWanUpdate.
protected final void publishWanUpdate(Data dataKey, Data dataValue, CacheRecord record) {
if (!recordStore.isWanReplicationEnabled() || record == null) {
return;
}
NodeEngine nodeEngine = getNodeEngine();
SerializationService serializationService = nodeEngine.getSerializationService();
Data dataExpiryPolicy = toHeapData(serializationService.toData(record.getExpiryPolicy()));
publishWanUpdate(dataKey, dataValue, dataExpiryPolicy, record);
}
Aggregations