use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class DistributedExecutorServiceTest method setup.
@Before
public void setup() {
Config config = new Config();
config.addExecutorConfig(new ExecutorConfig().setName(EXECUTOR_NAME).setStatisticsEnabled(false));
hz = createHazelcastInstance(config);
NodeEngineImpl nodeEngine = getNodeEngineImpl(hz);
distributedExecutorService = nodeEngine.getService(DistributedExecutorService.SERVICE_NAME);
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class ClientListenersTest method testEntryMergeListener_withPortableNotRegisteredInNode.
@Test
public void testEntryMergeListener_withPortableNotRegisteredInNode() throws Exception {
final IMap<Object, Object> map = client.getMap(randomMapName());
final CountDownLatch latch = new CountDownLatch(1);
map.addEntryListener(new EntryMergedListener<Object, Object>() {
@Override
public void entryMerged(EntryEvent<Object, Object> event) {
latch.countDown();
}
}, true);
Node node = getNode(server);
NodeEngineImpl nodeEngine = node.nodeEngine;
OperationServiceImpl operationService = (OperationServiceImpl) nodeEngine.getOperationService();
SerializationService serializationService = getSerializationService(server);
Data key = serializationService.toData(1);
Data value = serializationService.toData(new ClientRegressionWithMockNetworkTest.SamplePortable(1));
EntryView entryView = EntryViews.createSimpleEntryView(key, value, Mockito.mock(Record.class));
MergeOperation op = new MergeOperation(map.getName(), key, entryView, new PassThroughMergePolicy());
int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
operationService.invokeOnPartition(MapService.SERVICE_NAME, op, partitionId);
assertOpenEventually(latch);
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class LockAdvancedTest method testLockCleanup_whenInvokingMemberDies.
@Test
public void testLockCleanup_whenInvokingMemberDies() {
TestHazelcastInstanceFactory factory = createHazelcastInstanceFactory(2);
HazelcastInstance hz = factory.newHazelcastInstance();
HazelcastInstance hz2 = factory.newHazelcastInstance();
NodeEngineImpl nodeEngine = getNodeEngineImpl(hz2);
InternalOperationService operationService = getOperationService(hz2);
warmUpPartitions(hz2);
String name = randomNameOwnedBy(hz);
Data key = nodeEngine.toData(name);
int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
operationService.invokeOnPartition(LockService.SERVICE_NAME, new SlowLockOperation(name, key, 2000), partitionId);
sleepMillis(500);
terminateInstance(hz2);
final ILock lock = hz.getLock(name);
assertTrueEventually(new AssertTask() {
@Override
public void run() throws Exception {
assertFalse("Lock owned by dead member should have been released!", lock.isLocked());
}
}, 30);
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class BaseMigrationOperation method executeBeforeMigrations.
void executeBeforeMigrations() throws Exception {
NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
PartitionMigrationEvent event = getMigrationEvent();
Throwable t = null;
for (MigrationAwareService service : nodeEngine.getServices(MigrationAwareService.class)) {
// we need to make sure all beforeMigration() methods are executed
try {
service.beforeMigration(event);
} catch (Throwable e) {
getLogger().warning("Error while executing beforeMigration()", e);
t = e;
}
}
if (t != null) {
throw ExceptionUtil.rethrow(t);
}
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class ReplicaSyncRequest method logNoReplicaDataFound.
private void logNoReplicaDataFound(int partitionId, int replicaIndex) {
NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
ILogger logger = nodeEngine.getLogger(getClass());
if (logger.isFinestEnabled()) {
logger.finest("No replica data is found for partitionId=" + partitionId + ", replicaIndex=" + replicaIndex);
}
}
Aggregations