Search in sources :

Example 11 with NodeEngine

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

the class ExecutorServiceProxy method submitToMembers.

@Override
public <T> void submitToMembers(@Nonnull Callable<T> task, @Nonnull Collection<Member> members, @Nonnull MultiExecutionCallback callback) {
    checkNotNull(task, "task must not be null");
    checkNotNull(members, "members must not be null");
    NodeEngine nodeEngine = getNodeEngine();
    ILogger logger = nodeEngine.getLogger(ExecutionCallbackAdapterFactory.class);
    ExecutionCallbackAdapterFactory executionCallbackFactory = new ExecutionCallbackAdapterFactory(logger, members, callback);
    Data taskData = nodeEngine.toData(task);
    for (Member member : members) {
        submitToMember(taskData, member, executionCallbackFactory.<T>callbackFor(member));
    }
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) ILogger(com.hazelcast.logging.ILogger) Data(com.hazelcast.internal.serialization.Data) Member(com.hazelcast.cluster.Member)

Example 12 with NodeEngine

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

the class LockStoreContainer method createScheduler.

private EntryTaskScheduler<Data, Integer> createScheduler(ObjectNamespace namespace) {
    NodeEngine nodeEngine = lockService.getNodeEngine();
    LockEvictionProcessor entryProcessor = new LockEvictionProcessor(nodeEngine, namespace);
    TaskScheduler globalScheduler = nodeEngine.getExecutionService().getGlobalTaskScheduler();
    return EntryTaskSchedulerFactory.newScheduler(globalScheduler, entryProcessor, ScheduleType.FOR_EACH);
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) TaskScheduler(com.hazelcast.spi.impl.executionservice.TaskScheduler) EntryTaskScheduler(com.hazelcast.internal.util.scheduler.EntryTaskScheduler)

Example 13 with NodeEngine

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

the class LocalLockCleanupOperation method shouldBackup.

@Override
public boolean shouldBackup() {
    final NodeEngine nodeEngine = getNodeEngine();
    IPartitionService partitionService = nodeEngine.getPartitionService();
    IPartition partition = partitionService.getPartition(getPartitionId());
    return partition.isLocal() && Boolean.TRUE.equals(response);
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) IPartitionService(com.hazelcast.internal.partition.IPartitionService) IPartition(com.hazelcast.internal.partition.IPartition)

Example 14 with NodeEngine

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

the class BaseMigrationOperation method verifyClusterState.

/**
 * Verifies that the cluster is active.
 */
private void verifyClusterState() {
    NodeEngine nodeEngine = getNodeEngine();
    ClusterState clusterState = nodeEngine.getClusterService().getClusterState();
    if (!clusterState.isMigrationAllowed()) {
        throw new IllegalStateException("Cluster state does not allow migrations! " + clusterState);
    }
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) ClusterState(com.hazelcast.cluster.ClusterState)

Example 15 with NodeEngine

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

the class MigrationCommitOperation method run.

@Override
public void run() {
    NodeEngine nodeEngine = getNodeEngine();
    final Member localMember = nodeEngine.getLocalMember();
    if (!localMember.getUuid().equals(expectedMemberUuid)) {
        throw new IllegalStateException("This " + localMember + " is migration commit destination but most probably it's restarted " + "and not the expected target.");
    }
    InternalPartitionServiceImpl service = getService();
    success = service.commitMigrationOnDestination(migration, getCallerAddress());
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) InternalPartitionServiceImpl(com.hazelcast.internal.partition.impl.InternalPartitionServiceImpl) Member(com.hazelcast.cluster.Member)

Aggregations

NodeEngine (com.hazelcast.spi.impl.NodeEngine)165 Data (com.hazelcast.internal.serialization.Data)48 OperationService (com.hazelcast.spi.impl.operationservice.OperationService)30 Address (com.hazelcast.cluster.Address)22 Test (org.junit.Test)21 ILogger (com.hazelcast.logging.ILogger)20 HazelcastInstance (com.hazelcast.core.HazelcastInstance)18 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)18 QuickTest (com.hazelcast.test.annotation.QuickTest)18 Config (com.hazelcast.config.Config)17 Operation (com.hazelcast.spi.impl.operationservice.Operation)16 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)15 IPartitionService (com.hazelcast.internal.partition.IPartitionService)12 Nonnull (javax.annotation.Nonnull)12 ArrayList (java.util.ArrayList)11 Future (java.util.concurrent.Future)11 Member (com.hazelcast.cluster.Member)10 UUID (java.util.UUID)10 InitializingObject (com.hazelcast.spi.impl.InitializingObject)9 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)9