use of com.hazelcast.instance.Node in project orientdb by orientechnologies.
the class ServerRun method terminateServer.
public void terminateServer() {
if (server != null) {
try {
HazelcastInstance hz = ((OHazelcastPlugin) server.getDistributedManager()).getHazelcastInstance();
final Node node = getHazelcastNode(hz);
node.getConnectionManager().shutdown();
node.shutdown(true);
hz.getLifecycleService().terminate();
} catch (Exception e) {
// IGNORE IT
}
try {
server.shutdown();
} catch (Exception e) {
// IGNORE IT
}
}
closeStorages();
}
use of com.hazelcast.instance.Node in project orientdb by orientechnologies.
the class ServerRun method rejoin.
public void rejoin(final ServerRun... serverIds) {
final Node currentNode = getHazelcastNode(((OHazelcastPlugin) server.getDistributedManager()).getHazelcastInstance());
for (ServerRun s : serverIds) {
final Node otherNode = getHazelcastNode(((OHazelcastPlugin) s.server.getDistributedManager()).getHazelcastInstance());
final ClusterServiceImpl clusterService = currentNode.getClusterService();
clusterService.merge(otherNode.address);
}
}
use of com.hazelcast.instance.Node in project hazelcast by hazelcast.
the class ConnectedClientOperationTest method testGetConnectedClientsOperation_WhenMoreThanZeroClientConnects.
@Test
public void testGetConnectedClientsOperation_WhenMoreThanZeroClientConnects() throws Exception {
HazelcastInstance instance = factory.newHazelcastInstance();
factory.newHazelcastClient();
factory.newHazelcastClient();
Node node = TestUtil.getNode(instance);
Operation operation = new GetConnectedClientsOperation();
OperationService operationService = node.nodeEngine.getOperationService();
Future<Map<String, ClientType>> future = operationService.invokeOnTarget(ClientEngineImpl.SERVICE_NAME, operation, node.address);
Map<String, ClientType> clients = future.get();
assertEquals(2, clients.size());
}
use of com.hazelcast.instance.Node in project hazelcast by hazelcast.
the class ListenerLeakTestSmartRouting method testTopicMessageListener.
@Test
public void testTopicMessageListener() {
Collection<Node> nodes = createNodes();
HazelcastInstance client = hazelcastFactory.newHazelcastClient();
ITopic<Object> topic = client.getTopic(randomString());
String id = topic.addMessageListener(mock(MessageListener.class));
Collection<ClientEventRegistration> registrations = getClientEventRegistrations(client, id);
assertTrue(topic.removeMessageListener(id));
assertNoLeftOver(nodes, client, id, registrations);
}
use of com.hazelcast.instance.Node in project hazelcast by hazelcast.
the class ListenerLeakTestSmartRouting method testDistributedObjectListeners.
@Test
public void testDistributedObjectListeners() {
Collection<Node> nodes = createNodes();
HazelcastInstance client = hazelcastFactory.newHazelcastClient();
String id = client.addDistributedObjectListener(mock(DistributedObjectListener.class));
Collection<ClientEventRegistration> registrations = getClientEventRegistrations(client, id);
assertTrue(client.removeDistributedObjectListener(id));
assertNoLeftOver(nodes, client, id, registrations);
}
Aggregations