Search in sources :

Example 86 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl 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 87 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class MapStoreWrapper method instrument.

public void instrument(NodeEngine nodeEngine) {
    Diagnostics diagnostics = ((NodeEngineImpl) nodeEngine).getDiagnostics();
    StoreLatencyPlugin storeLatencyPlugin = diagnostics.getPlugin(StoreLatencyPlugin.class);
    if (storeLatencyPlugin == null) {
        return;
    }
    if (mapLoader != null) {
        this.mapLoader = new LatencyTrackingMapLoader(mapLoader, storeLatencyPlugin, mapName);
    }
    if (mapStore != null) {
        this.mapStore = new LatencyTrackingMapStore(mapStore, storeLatencyPlugin, mapName);
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) Diagnostics(com.hazelcast.internal.diagnostics.Diagnostics) StoreLatencyPlugin(com.hazelcast.internal.diagnostics.StoreLatencyPlugin)

Example 88 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class Backup method run.

@Override
public void run() throws Exception {
    if (!valid) {
        onExecutionFailure(new IllegalStateException("Wrong target! " + toString() + " cannot be processed!"));
        return;
    }
    ensureBackupOperationInitialized();
    backupOp.beforeRun();
    backupOp.run();
    backupOp.afterRun();
    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    InternalPartitionService partitionService = nodeEngine.getPartitionService();
    partitionService.updatePartitionReplicaVersions(getPartitionId(), replicaVersions, getReplicaIndex());
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService)

Example 89 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class BroadcastTxRollbackOperation method run.

@Override
public void run() throws Exception {
    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    Collection<TransactionalService> services = nodeEngine.getServices(TransactionalService.class);
    for (TransactionalService service : services) {
        try {
            service.rollbackTransaction(txnId);
        } catch (Exception e) {
            getLogger().warning("Error while rolling back transaction: " + txnId, e);
        }
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) TransactionalService(com.hazelcast.spi.TransactionalService) MemberLeftException(com.hazelcast.core.MemberLeftException) IOException(java.io.IOException)

Example 90 with NodeEngineImpl

use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.

the class InvokeOnPartitions method awaitCompletion.

private void awaitCompletion() {
    NodeEngineImpl nodeEngine = operationService.nodeEngine;
    for (Map.Entry<Address, Future> response : futures.entrySet()) {
        try {
            Future future = response.getValue();
            PartitionResponse result = (PartitionResponse) nodeEngine.toObject(future.get());
            result.addResults(partitionResults);
        } catch (Throwable t) {
            if (operationService.logger.isFinestEnabled()) {
                operationService.logger.finest(t);
            } else {
                operationService.logger.warning(t.getMessage());
            }
            List<Integer> partitions = memberPartitions.get(response.getKey());
            for (Integer partition : partitions) {
                partitionResults.put(partition, t);
            }
        }
    }
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) PartitionResponse(com.hazelcast.spi.impl.operationservice.impl.operations.PartitionIteratingOperation.PartitionResponse) Address(com.hazelcast.nio.Address) Future(java.util.concurrent.Future) List(java.util.List) LinkedList(java.util.LinkedList) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)112 HazelcastInstance (com.hazelcast.core.HazelcastInstance)39 Test (org.junit.Test)32 ParallelTest (com.hazelcast.test.annotation.ParallelTest)31 QuickTest (com.hazelcast.test.annotation.QuickTest)31 Node (com.hazelcast.instance.Node)21 MapService (com.hazelcast.map.impl.MapService)20 Config (com.hazelcast.config.Config)19 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)19 InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)16 MetaDataGenerator (com.hazelcast.internal.nearcache.impl.invalidation.MetaDataGenerator)14 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)14 ILogger (com.hazelcast.logging.ILogger)11 AssertTask (com.hazelcast.test.AssertTask)11 Invalidator (com.hazelcast.internal.nearcache.impl.invalidation.Invalidator)10 MapNearCacheManager (com.hazelcast.map.impl.nearcache.MapNearCacheManager)10 Address (com.hazelcast.nio.Address)10 Data (com.hazelcast.nio.serialization.Data)10 Before (org.junit.Before)10 Operation (com.hazelcast.spi.Operation)9