Search in sources :

Example 61 with ILogger

use of com.hazelcast.logging.ILogger in project hazelcast by hazelcast.

the class MemberRemoveOperation method run.

@Override
public void run() {
    ClusterServiceImpl clusterService = getService();
    Address caller = getCallerAddress();
    ILogger logger = getLogger();
    if (!isCallerValid(caller)) {
        return;
    }
    String msg = "Removing member " + address + (memberUuid != null ? ", uuid: " + memberUuid : "") + ", requested by: " + caller;
    if (logger.isFineEnabled()) {
        logger.fine(msg);
    }
    if (memberUuid != null) {
        clusterService.removeAddress(address, memberUuid, msg);
    } else {
        clusterService.removeAddress(address, msg);
    }
}
Also used : Address(com.hazelcast.nio.Address) ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl) ILogger(com.hazelcast.logging.ILogger)

Example 62 with ILogger

use of com.hazelcast.logging.ILogger in project hazelcast by hazelcast.

the class SplitBrainMergeValidationOperation method preCheck.

private boolean preCheck(Node node) {
    ILogger logger = getLogger();
    if (!node.joined()) {
        logger.info("Ignoring join check from " + getCallerAddress() + ", because this node is not joined to a cluster yet...");
        return false;
    }
    if (!node.isRunning()) {
        logger.info("Ignoring join check from " + getCallerAddress() + ", because this node is not active...");
        return false;
    }
    final ClusterState clusterState = node.clusterService.getClusterState();
    if (clusterState != ClusterState.ACTIVE) {
        logger.info("Ignoring join check from " + getCallerAddress() + ", because cluster is in " + clusterState + " state ...");
        return false;
    }
    return true;
}
Also used : ClusterState(com.hazelcast.cluster.ClusterState) ILogger(com.hazelcast.logging.ILogger)

Example 63 with ILogger

use of com.hazelcast.logging.ILogger in project hazelcast by hazelcast.

the class SplitBrainMergeValidationOperation method masterCheck.

private boolean masterCheck(Node node) {
    ILogger logger = getLogger();
    Address caller = getCallerAddress();
    ClusterServiceImpl service = getService();
    if (node.isMaster()) {
        if (service.getMember(caller) != null) {
            logger.info("Removing " + caller + ", since it thinks it's already split from this cluster " + "and looking to merge.");
            removeCaller = true;
        }
        return true;
    } else {
        // ping master to check if it's still valid
        service.getClusterHeartbeatManager().sendMasterConfirmation();
        logger.info("Ignoring join check from " + caller + ", because this node is not master...");
        return false;
    }
}
Also used : Address(com.hazelcast.nio.Address) ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl) ILogger(com.hazelcast.logging.ILogger)

Example 64 with ILogger

use of com.hazelcast.logging.ILogger 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 65 with ILogger

use of com.hazelcast.logging.ILogger 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)

Aggregations

ILogger (com.hazelcast.logging.ILogger)76 Address (com.hazelcast.nio.Address)19 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)11 Node (com.hazelcast.instance.Node)10 InternalPartitionServiceImpl (com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl)10 NodeEngine (com.hazelcast.spi.NodeEngine)10 ClusterServiceImpl (com.hazelcast.internal.cluster.impl.ClusterServiceImpl)9 ReplicatedMapService (com.hazelcast.replicatedmap.impl.ReplicatedMapService)6 OperationService (com.hazelcast.spi.OperationService)6 IOException (java.io.IOException)4 Before (org.junit.Before)4 JsonObject (com.eclipsesource.json.JsonObject)3 ClientAwsConfig (com.hazelcast.client.config.ClientAwsConfig)3 Connection (com.hazelcast.nio.Connection)3 ReplicatedRecordStore (com.hazelcast.replicatedmap.impl.record.ReplicatedRecordStore)3 Operation (com.hazelcast.spi.Operation)3 HazelcastProperties (com.hazelcast.spi.properties.HazelcastProperties)3 JsonUtil.getString (com.hazelcast.util.JsonUtil.getString)3 ClientNetworkConfig (com.hazelcast.client.config.ClientNetworkConfig)2 ClusterState (com.hazelcast.cluster.ClusterState)2