Search in sources :

Example 11 with ILogger

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

the class ForceStartNodeRequest method writeResponse.

@Override
public void writeResponse(ManagementCenterService mcs, JsonObject out) throws Exception {
    String resultString;
    HazelcastInstanceImpl instance = mcs.getHazelcastInstance();
    try {
        resultString = instance.node.getNodeExtension().getInternalHotRestartService().triggerForceStart() ? SUCCESS_RESULT : FAILED_RESULT;
    } catch (Exception e) {
        ILogger logger = instance.node.getLogger(getClass());
        logger.warning("Problem on force start: ", e);
        resultString = e.getMessage();
    }
    JsonObject result = new JsonObject().add("result", resultString);
    out.add("result", result);
}
Also used : HazelcastInstanceImpl(com.hazelcast.instance.HazelcastInstanceImpl) JsonObject(com.eclipsesource.json.JsonObject) ILogger(com.hazelcast.logging.ILogger) JsonUtil.getString(com.hazelcast.util.JsonUtil.getString) IOException(java.io.IOException)

Example 12 with ILogger

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

the class ChangeClusterStateRequest method writeResponse.

@Override
public void writeResponse(ManagementCenterService mcs, JsonObject out) throws Exception {
    String resultString = "SUCCESS";
    try {
        Cluster cluster = mcs.getHazelcastInstance().getCluster();
        cluster.changeClusterState(getClusterState(state));
    } catch (Exception e) {
        ILogger logger = mcs.getHazelcastInstance().node.nodeEngine.getLogger(getClass());
        logger.warning("Cluster state can not be changed: ", e);
        resultString = FAILURE + e.getMessage();
    }
    JsonObject result = new JsonObject().add("result", resultString);
    out.add("result", result);
}
Also used : Cluster(com.hazelcast.core.Cluster) JsonObject(com.eclipsesource.json.JsonObject) ILogger(com.hazelcast.logging.ILogger) JsonUtil.getString(com.hazelcast.util.JsonUtil.getString) IOException(java.io.IOException)

Example 13 with ILogger

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

the class ReplicaSyncResponse method nodeNotOwnsBackup.

/** Fail all replication operations with the exception that this node is no longer the replica with the sent index */
private void nodeNotOwnsBackup(InternalPartitionImpl partition) {
    int partitionId = getPartitionId();
    int replicaIndex = getReplicaIndex();
    Address thisAddress = getNodeEngine().getThisAddress();
    int currentReplicaIndex = partition.getReplicaIndex(thisAddress);
    ILogger logger = getLogger();
    if (logger.isFinestEnabled()) {
        logger.finest("This node is not backup replica of partitionId=" + partitionId + ", replicaIndex=" + replicaIndex + " anymore. current replicaIndex=" + currentReplicaIndex);
    }
    if (tasks != null) {
        Throwable throwable = new WrongTargetException(thisAddress, partition.getReplicaAddress(replicaIndex), partitionId, replicaIndex, getClass().getName());
        for (Operation op : tasks) {
            prepareOperation(op);
            onOperationFailure(op, throwable);
        }
    }
}
Also used : Address(com.hazelcast.nio.Address) ILogger(com.hazelcast.logging.ILogger) UrgentSystemOperation(com.hazelcast.spi.UrgentSystemOperation) PartitionAwareOperation(com.hazelcast.spi.PartitionAwareOperation) Operation(com.hazelcast.spi.Operation) BackupOperation(com.hazelcast.spi.BackupOperation) WrongTargetException(com.hazelcast.spi.exception.WrongTargetException)

Example 14 with ILogger

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

the class ReplicaSyncRetryResponse method run.

@Override
public void run() throws Exception {
    final InternalPartitionServiceImpl partitionService = getService();
    final int partitionId = getPartitionId();
    final int replicaIndex = getReplicaIndex();
    partitionService.getReplicaManager().clearReplicaSyncRequest(partitionId, replicaIndex);
    PartitionStateManager partitionStateManager = partitionService.getPartitionStateManager();
    InternalPartitionImpl partition = partitionStateManager.getPartitionImpl(partitionId);
    Address thisAddress = getNodeEngine().getThisAddress();
    ILogger logger = getLogger();
    int currentReplicaIndex = partition.getReplicaIndex(thisAddress);
    if (currentReplicaIndex > 0) {
        if (logger.isFinestEnabled()) {
            logger.finest("Retrying replica sync request for partitionId=" + partitionId + ", initial-replicaIndex=" + replicaIndex + ", current-replicaIndex=" + currentReplicaIndex);
        }
        partitionService.getReplicaManager().triggerPartitionReplicaSync(partitionId, currentReplicaIndex, InternalPartitionService.REPLICA_SYNC_RETRY_DELAY);
    } else if (logger.isFinestEnabled()) {
        logger.finest("No need to retry replica sync request for partitionId=" + partitionId + ", initial-replicaIndex=" + replicaIndex + ", current-replicaIndex=" + currentReplicaIndex);
    }
}
Also used : Address(com.hazelcast.nio.Address) InternalPartitionServiceImpl(com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl) InternalPartitionImpl(com.hazelcast.internal.partition.impl.InternalPartitionImpl) ILogger(com.hazelcast.logging.ILogger) PartitionStateManager(com.hazelcast.internal.partition.impl.PartitionStateManager)

Example 15 with ILogger

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

the class PromotionCommitOperation method beforePromotion.

private void beforePromotion() {
    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    InternalOperationService operationService = nodeEngine.getOperationService();
    InternalPartitionServiceImpl partitionService = getService();
    ILogger logger = getLogger();
    if (logger.isFineEnabled()) {
        logger.fine("Submitting BeforePromotionOperations for " + promotions.size() + " promotions.");
    }
    Runnable beforePromotionsCallback = new BeforePromotionOperationCallback(this, new AtomicInteger(promotions.size()));
    for (MigrationInfo promotion : promotions) {
        if (logger.isFinestEnabled()) {
            logger.finest("Submitting BeforePromotionOperation for promotion: " + promotion);
        }
        int currentReplicaIndex = promotion.getDestinationCurrentReplicaIndex();
        BeforePromotionOperation op = new BeforePromotionOperation(currentReplicaIndex, beforePromotionsCallback);
        op.setPartitionId(promotion.getPartitionId()).setNodeEngine(nodeEngine).setService(partitionService);
        operationService.execute(op);
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) MigrationInfo(com.hazelcast.internal.partition.MigrationInfo) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) InternalPartitionServiceImpl(com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl) ILogger(com.hazelcast.logging.ILogger) InternalOperationService(com.hazelcast.spi.impl.operationservice.InternalOperationService)

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