Search in sources :

Example 26 with ClusterServiceImpl

use of com.hazelcast.internal.cluster.impl.ClusterServiceImpl in project hazelcast by hazelcast.

the class InternalPartitionServiceImpl method firePartitionStateOperation.

private List<Future<Boolean>> firePartitionStateOperation(Collection<MemberImpl> members, PartitionRuntimeState partitionState, OperationService operationService) {
    final ClusterServiceImpl clusterService = node.clusterService;
    List<Future<Boolean>> calls = new ArrayList<Future<Boolean>>(members.size());
    for (MemberImpl member : members) {
        if (!(member.localMember() || clusterService.isMemberRemovedWhileClusterIsNotActive(member.getAddress()))) {
            try {
                Address address = member.getAddress();
                PartitionStateOperation operation = new PartitionStateOperation(partitionState, true);
                Future<Boolean> f = operationService.invokeOnTarget(SERVICE_NAME, operation, address);
                calls.add(f);
            } catch (Exception e) {
                logger.finest(e);
            }
        }
    }
    return calls;
}
Also used : Address(com.hazelcast.nio.Address) MemberImpl(com.hazelcast.instance.MemberImpl) ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl) ArrayList(java.util.ArrayList) Future(java.util.concurrent.Future) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) FetchPartitionStateOperation(com.hazelcast.internal.partition.operation.FetchPartitionStateOperation) PartitionStateOperation(com.hazelcast.internal.partition.operation.PartitionStateOperation) HazelcastInstanceNotActiveException(com.hazelcast.core.HazelcastInstanceNotActiveException) TargetNotMemberException(com.hazelcast.spi.exception.TargetNotMemberException) NoDataMemberInClusterException(com.hazelcast.partition.NoDataMemberInClusterException) MemberLeftException(com.hazelcast.core.MemberLeftException) ExecutionException(java.util.concurrent.ExecutionException)

Example 27 with ClusterServiceImpl

use of com.hazelcast.internal.cluster.impl.ClusterServiceImpl in project hazelcast by hazelcast.

the class HeartbeatOperation method run.

@Override
public void run() {
    ClusterServiceImpl service = getService();
    MemberImpl member = service.getMember(getCallerAddress());
    if (member == null) {
        ILogger logger = getLogger();
        if (logger.isFineEnabled()) {
            logger.fine("Heartbeat received from an unknown endpoint: " + getCallerAddress());
        }
        return;
    }
    service.getClusterHeartbeatManager().onHeartbeat(member, timestamp);
}
Also used : MemberImpl(com.hazelcast.instance.MemberImpl) ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl) ILogger(com.hazelcast.logging.ILogger)

Example 28 with ClusterServiceImpl

use of com.hazelcast.internal.cluster.impl.ClusterServiceImpl in project hazelcast by hazelcast.

the class JoinRequestOperation method run.

@Override
public void run() {
    ClusterServiceImpl cm = getService();
    cm.getClusterJoinManager().handleJoinRequest(request, getConnection());
}
Also used : ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl)

Example 29 with ClusterServiceImpl

use of com.hazelcast.internal.cluster.impl.ClusterServiceImpl in project hazelcast by hazelcast.

the class LockClusterStateOperation method run.

@Override
public void run() throws Exception {
    ClusterServiceImpl service = getService();
    ClusterStateManager clusterStateManager = service.getClusterStateManager();
    ClusterState state = clusterStateManager.getState();
    if (state == ClusterState.IN_TRANSITION) {
        getLogger().info("Extending cluster state lock. Initiator: " + initiator + ", lease-time: " + leaseTime);
    } else {
        getLogger().info("Locking cluster state. Initiator: " + initiator + ", lease-time: " + leaseTime);
    }
    clusterStateManager.lockClusterState(stateChange, initiator, txnId, leaseTime, partitionStateVersion);
}
Also used : ClusterState(com.hazelcast.cluster.ClusterState) ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl) ClusterStateManager(com.hazelcast.internal.cluster.impl.ClusterStateManager)

Example 30 with ClusterServiceImpl

use of com.hazelcast.internal.cluster.impl.ClusterServiceImpl in project hazelcast by hazelcast.

the class MasterDiscoveryOperation method run.

@Override
public void run() {
    ClusterServiceImpl cm = getService();
    cm.getClusterJoinManager().answerMasterQuestion(joinMessage, getConnection());
}
Also used : ClusterServiceImpl(com.hazelcast.internal.cluster.impl.ClusterServiceImpl)

Aggregations

ClusterServiceImpl (com.hazelcast.internal.cluster.impl.ClusterServiceImpl)41 Node (com.hazelcast.instance.Node)13 Address (com.hazelcast.nio.Address)13 ILogger (com.hazelcast.logging.ILogger)9 NodeEngineImpl (com.hazelcast.spi.impl.NodeEngineImpl)8 ClusterState (com.hazelcast.cluster.ClusterState)6 MemberImpl (com.hazelcast.instance.MemberImpl)5 HazelcastInstance (com.hazelcast.core.HazelcastInstance)4 OperationService (com.hazelcast.spi.OperationService)4 Member (com.hazelcast.core.Member)3 MemberLeftException (com.hazelcast.core.MemberLeftException)3 ClusterStateManager (com.hazelcast.internal.cluster.impl.ClusterStateManager)3 Config (com.hazelcast.config.Config)2 InternalPartition (com.hazelcast.internal.partition.InternalPartition)2 Connection (com.hazelcast.nio.Connection)2 Operation (com.hazelcast.spi.Operation)2 InternalOperationService (com.hazelcast.spi.impl.operationservice.InternalOperationService)2 TestHazelcastInstanceFactory (com.hazelcast.test.TestHazelcastInstanceFactory)2 ParallelTest (com.hazelcast.test.annotation.ParallelTest)2 QuickTest (com.hazelcast.test.annotation.QuickTest)2