Search in sources :

Example 86 with Node

use of com.hazelcast.instance.Node in project hazelcast by hazelcast.

the class BeforeJoinCheckFailureOperation method run.

@Override
public void run() {
    final NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    final Node node = nodeEngine.getNode();
    if (node.joined()) {
        throw new IllegalStateException("Node is already joined but received a termination message! " + "Reason: " + failReasonMsg);
    }
    final ILogger logger = nodeEngine.getLogger("com.hazelcast.security");
    logger.severe("Node could not join cluster. Before join check failed node is going to shutdown now!");
    logger.severe("Reason of failure for node join : " + failReasonMsg);
    node.shutdown(true);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Node(com.hazelcast.instance.Node) ILogger(com.hazelcast.logging.ILogger)

Example 87 with Node

use of com.hazelcast.instance.Node in project hazelcast by hazelcast.

the class GroupMismatchOperation method run.

@Override
public void run() {
    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    Connection connection = getConnection();
    String message = "Node could not join cluster at node: " + connection.getEndPoint() + " Cause: the target cluster has a different group-name";
    connection.close(message, null);
    ILogger logger = nodeEngine.getLogger("com.hazelcast.cluster");
    logger.warning(message);
    Node node = nodeEngine.getNode();
    node.getJoiner().blacklist(getCallerAddress(), true);
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Node(com.hazelcast.instance.Node) Connection(com.hazelcast.nio.Connection) ILogger(com.hazelcast.logging.ILogger)

Example 88 with Node

use of com.hazelcast.instance.Node in project hazelcast by hazelcast.

the class ServiceManagerImpl method createService.

private <T> T createService(Class<T> service) {
    Node node = nodeEngine.getNode();
    NodeExtension nodeExtension = node.getNodeExtension();
    return nodeExtension.createService(service);
}
Also used : Node(com.hazelcast.instance.Node) NodeExtension(com.hazelcast.instance.NodeExtension)

Example 89 with Node

use of com.hazelcast.instance.Node in project hazelcast by hazelcast.

the class ServiceManagerImpl method registerCoreServices.

private void registerCoreServices() {
    logger.finest("Registering core services...");
    Node node = nodeEngine.getNode();
    registerService(ClusterServiceImpl.SERVICE_NAME, node.getClusterService());
    registerService(InternalPartitionService.SERVICE_NAME, node.getPartitionService());
    registerService(ProxyServiceImpl.SERVICE_NAME, nodeEngine.getProxyService());
    registerService(TransactionManagerServiceImpl.SERVICE_NAME, nodeEngine.getTransactionManagerService());
    registerService(ClientEngineImpl.SERVICE_NAME, node.clientEngine);
    registerService(QuorumServiceImpl.SERVICE_NAME, nodeEngine.getQuorumService());
    registerService(WanReplicationService.SERVICE_NAME, nodeEngine.getWanReplicationService());
}
Also used : Node(com.hazelcast.instance.Node)

Example 90 with Node

use of com.hazelcast.instance.Node in project hazelcast by hazelcast.

the class ListenerLeakTestSmartRouting method testSetListeners.

@Test
public void testSetListeners() {
    Collection<Node> nodes = createNodes();
    HazelcastInstance client = hazelcastFactory.newHazelcastClient();
    ISet<Object> set = client.getSet(randomString());
    String id = set.addItemListener(mock(ItemListener.class), false);
    Collection<ClientEventRegistration> registrations = getClientEventRegistrations(client, id);
    assertTrue(set.removeItemListener(id));
    assertNoLeftOver(nodes, client, id, registrations);
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) ClientEventRegistration(com.hazelcast.client.spi.impl.listener.ClientEventRegistration) Node(com.hazelcast.instance.Node) ItemListener(com.hazelcast.core.ItemListener) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

Node (com.hazelcast.instance.Node)131 HazelcastInstance (com.hazelcast.core.HazelcastInstance)60 Test (org.junit.Test)50 QuickTest (com.hazelcast.test.annotation.QuickTest)45 ParallelTest (com.hazelcast.test.annotation.ParallelTest)42 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)21 ClientEventRegistration (com.hazelcast.client.spi.impl.listener.ClientEventRegistration)18 Address (com.hazelcast.nio.Address)17 Config (com.hazelcast.config.Config)14 ClusterServiceImpl (com.hazelcast.internal.cluster.impl.ClusterServiceImpl)13 ILogger (com.hazelcast.logging.ILogger)10 Data (com.hazelcast.nio.serialization.Data)10 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)10 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)9 StringUtil.bytesToString (com.hazelcast.util.StringUtil.bytesToString)8 CountDownLatch (java.util.concurrent.CountDownLatch)8 ClusterService (com.hazelcast.internal.cluster.ClusterService)7 SerializationService (com.hazelcast.spi.serialization.SerializationService)7 ItemListener (com.hazelcast.core.ItemListener)6 Operation (com.hazelcast.spi.Operation)6