Search in sources :

Example 1 with IPartition

use of com.hazelcast.internal.partition.IPartition 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 2 with IPartition

use of com.hazelcast.internal.partition.IPartition in project hazelcast by hazelcast.

the class ConsumeAccumulatorOperation method isLocal.

private boolean isLocal() {
    NodeEngine nodeEngine = getNodeEngine();
    IPartitionService partitionService = nodeEngine.getPartitionService();
    IPartition partition = partitionService.getPartition(getPartitionId());
    return partition.isLocal();
}
Also used : NodeEngine(com.hazelcast.spi.impl.NodeEngine) IPartitionService(com.hazelcast.internal.partition.IPartitionService) IPartition(com.hazelcast.internal.partition.IPartition)

Example 3 with IPartition

use of com.hazelcast.internal.partition.IPartition in project hazelcast by hazelcast.

the class ClearExpiredRecordsTask method runInternal.

private void runInternal() {
    runningCleanupOperationsCount = 0;
    long nowInMillis = nowInMillis();
    boolean lostPartitionDetected = lostPartitionDetected();
    List<T> containersToProcess = null;
    for (int partitionId = 0; partitionId < partitionCount; partitionId++) {
        T container = this.containers[partitionId];
        IPartition partition = partitionService.getPartition(partitionId, false);
        if (partition.isMigrating()) {
            continue;
        }
        if (partition.isLocal()) {
            if (lostPartitionDetected) {
                equalizeBackupSizeWithPrimary(container);
            }
        }
        if (canProcessContainer(container, partition, nowInMillis)) {
            containersToProcess = addContainerTo(containersToProcess, container);
        }
    }
    if (!isEmpty(containersToProcess)) {
        sortPartitionContainers(containersToProcess);
        sendCleanupOperations(containersToProcess);
    }
    sendExpiryQueuesToBackupIncrementally();
}
Also used : IPartition(com.hazelcast.internal.partition.IPartition)

Example 4 with IPartition

use of com.hazelcast.internal.partition.IPartition in project hazelcast by hazelcast.

the class LocalMapStatsProvider method getReplicaAddress.

/**
 * Gets replica address. Waits if necessary.
 *
 * @see #waitForReplicaAddress
 */
private Address getReplicaAddress(int partitionId, int replicaNumber, int backupCount) {
    IPartition partition = partitionService.getPartition(partitionId);
    Address replicaAddress = partition.getReplicaAddress(replicaNumber);
    if (replicaAddress == null) {
        replicaAddress = waitForReplicaAddress(replicaNumber, partition, backupCount);
    }
    return replicaAddress;
}
Also used : Address(com.hazelcast.cluster.Address) IPartition(com.hazelcast.internal.partition.IPartition)

Example 5 with IPartition

use of com.hazelcast.internal.partition.IPartition in project hazelcast by hazelcast.

the class EvictorImpl method isBackup.

protected boolean isBackup(RecordStore recordStore) {
    int partitionId = recordStore.getPartitionId();
    IPartition partition = partitionService.getPartition(partitionId, false);
    return !partition.isLocal();
}
Also used : IPartition(com.hazelcast.internal.partition.IPartition)

Aggregations

IPartition (com.hazelcast.internal.partition.IPartition)28 Address (com.hazelcast.cluster.Address)11 HazelcastInstance (com.hazelcast.core.HazelcastInstance)9 Node (com.hazelcast.instance.impl.Node)7 Accessors.getNode (com.hazelcast.test.Accessors.getNode)6 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)5 PartitionContainer (com.hazelcast.map.impl.PartitionContainer)5 IPartitionService (com.hazelcast.internal.partition.IPartitionService)4 MapService (com.hazelcast.map.impl.MapService)4 MapServiceContext (com.hazelcast.map.impl.MapServiceContext)4 NodeEngine (com.hazelcast.spi.impl.NodeEngine)4 SerializationService (com.hazelcast.internal.serialization.SerializationService)3 RecordStore (com.hazelcast.map.impl.recordstore.RecordStore)3 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)3 QuickTest (com.hazelcast.test.annotation.QuickTest)3 HashSet (java.util.HashSet)3 Test (org.junit.Test)3 CacheService (com.hazelcast.cache.impl.CacheService)2 MigrationEndpoint (com.hazelcast.internal.partition.MigrationEndpoint)2 AbstractPartitionLostListenerTest (com.hazelcast.partition.AbstractPartitionLostListenerTest)2