use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class ReplicaSyncRequest method run.
@Override
public void run() throws Exception {
NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
InternalPartitionServiceImpl partitionService = (InternalPartitionServiceImpl) nodeEngine.getPartitionService();
int partitionId = getPartitionId();
int replicaIndex = getReplicaIndex();
if (!partitionService.isReplicaSyncAllowed()) {
ILogger logger = getLogger();
if (logger.isFinestEnabled()) {
logger.finest("Migration is paused! Cannot run replica sync -> " + toString());
}
sendRetryResponse();
return;
}
if (!preCheckReplicaSync(nodeEngine, partitionId, replicaIndex)) {
return;
}
try {
List<Operation> tasks = createReplicationOperations();
if (tasks.isEmpty()) {
logNoReplicaDataFound(partitionId, replicaIndex);
sendEmptyResponse();
} else {
sendResponse(tasks);
}
} finally {
partitionService.getReplicaManager().releaseReplicaSyncPermit();
}
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class MigrationRequestOperation method prepareMigrationOperations.
private Collection<Operation> prepareMigrationOperations() {
NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
PartitionReplicationEvent replicationEvent = new PartitionReplicationEvent(migrationInfo.getPartitionId(), migrationInfo.getDestinationNewReplicaIndex());
Collection<Operation> tasks = new LinkedList<Operation>();
for (ServiceInfo serviceInfo : nodeEngine.getServiceInfos(MigrationAwareService.class)) {
MigrationAwareService service = (MigrationAwareService) serviceInfo.getService();
Operation op = service.prepareReplicationOperation(replicationEvent);
if (op != null) {
op.setServiceName(serviceInfo.getName());
tasks.add(op);
}
}
return tasks;
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class BaseMigrationOperation method verifyClusterState.
private void verifyClusterState() {
final NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
ClusterState clusterState = nodeEngine.getClusterService().getClusterState();
if (clusterState != ClusterState.ACTIVE) {
throw new IllegalStateException("Cluster state is not active! " + clusterState);
}
final Node node = nodeEngine.getNode();
if (!node.getNodeExtension().isStartCompleted()) {
throw new IllegalStateException("Migration operation is received before startup is completed. " + "Caller: " + getCallerAddress());
}
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class FinalizeMigrationOperation method run.
@Override
public void run() {
NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
notifyServices(nodeEngine);
if (endpoint == MigrationEndpoint.SOURCE && success) {
commitSource();
} else if (endpoint == MigrationEndpoint.DESTINATION && !success) {
rollbackDestination();
}
InternalPartitionServiceImpl partitionService = getService();
PartitionStateManager partitionStateManager = partitionService.getPartitionStateManager();
partitionStateManager.clearMigratingFlag(migrationInfo.getPartitionId());
if (success) {
nodeEngine.onPartitionMigrate(migrationInfo);
}
}
use of com.hazelcast.spi.impl.NodeEngineImpl in project hazelcast by hazelcast.
the class MapDestroyTest method getMapServiceContext.
private MapServiceContext getMapServiceContext(HazelcastInstance instance) {
NodeEngineImpl nodeEngine1 = getNodeEngineImpl(instance);
MapService mapService = nodeEngine1.getService(MapService.SERVICE_NAME);
return mapService.getMapServiceContext();
}
Aggregations