use of com.hazelcast.internal.partition.operation.MigrationCommitOperation in project hazelcast by hazelcast.
the class MigrationManager method commitMigrationToDestination.
private boolean commitMigrationToDestination(Address destination, MigrationInfo migration) {
assert migration != null : "No migrations to commit! destination=" + destination;
if (node.getThisAddress().equals(destination)) {
if (logger.isFinestEnabled()) {
logger.finest("Shortcutting migration commit, since destination is master. -> " + migration);
}
return true;
}
MemberImpl member = node.getClusterService().getMember(destination);
if (member == null) {
logger.warning("Destination " + destination + " is not member anymore");
return false;
}
try {
if (logger.isFinestEnabled()) {
logger.finest("Sending commit operation to " + destination + " for " + migration);
}
PartitionRuntimeState partitionState = partitionService.createMigrationCommitPartitionState(migration);
String destinationUuid = member.getUuid();
MigrationCommitOperation operation = new MigrationCommitOperation(partitionState, destinationUuid);
Future<Boolean> future = nodeEngine.getOperationService().createInvocationBuilder(SERVICE_NAME, operation, destination).setTryCount(Integer.MAX_VALUE).setCallTimeout(Long.MAX_VALUE).invoke();
boolean result = future.get();
if (logger.isFinestEnabled()) {
logger.finest("Migration commit result " + result + " from " + destination + " for " + migration);
}
return result;
} catch (Throwable t) {
logMigrationCommitFailure(destination, migration, t);
}
return false;
}
use of com.hazelcast.internal.partition.operation.MigrationCommitOperation in project hazelcast by hazelcast.
the class PartitionDataSerializerHook method createFactory.
@Override
public DataSerializableFactory createFactory() {
ConstructorFunction<Integer, IdentifiedDataSerializable>[] constructors = new ConstructorFunction[LEN];
constructors[PARTITION_RUNTIME_STATE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new PartitionRuntimeState();
}
};
constructors[ASSIGN_PARTITIONS] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new AssignPartitions();
}
};
constructors[CHECK_REPLICA_VERSION] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new CheckReplicaVersion();
}
};
constructors[FETCH_PARTITION_STATE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new FetchPartitionStateOperation();
}
};
constructors[HAS_ONGOING_MIGRATION] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new HasOngoingMigration();
}
};
constructors[MIGRATION_COMMIT] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new MigrationCommitOperation();
}
};
constructors[MIGRATION] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new MigrationOperation();
}
};
constructors[MIGRATION_REQUEST] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new MigrationRequestOperation();
}
};
constructors[PARTITION_STATE_OP] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new PartitionStateOperation();
}
};
constructors[PROMOTION_COMMIT] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new PromotionCommitOperation();
}
};
constructors[REPLICA_SYNC_REQUEST] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new ReplicaSyncRequest();
}
};
constructors[REPLICA_SYNC_RESPONSE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new ReplicaSyncResponse();
}
};
constructors[REPLICA_SYNC_RETRY_RESPONSE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new ReplicaSyncRetryResponse();
}
};
constructors[SAFE_STATE_CHECK] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new SafeStateCheckOperation();
}
};
constructors[SHUTDOWN_REQUEST] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new ShutdownRequestOperation();
}
};
constructors[SHUTDOWN_RESPONSE] = new ConstructorFunction<Integer, IdentifiedDataSerializable>() {
public IdentifiedDataSerializable createNew(Integer arg) {
return new ShutdownResponseOperation();
}
};
return new ArrayDataSerializableFactory(constructors);
}
Aggregations