use of com.hazelcast.internal.partition.ReplicaMigrationEventImpl 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] = arg -> new PartitionRuntimeState();
constructors[ASSIGN_PARTITIONS] = arg -> new AssignPartitions();
constructors[PARTITION_BACKUP_REPLICA_ANTI_ENTROPY] = arg -> new PartitionBackupReplicaAntiEntropyOperation();
constructors[FETCH_PARTITION_STATE] = arg -> new FetchPartitionStateOperation();
constructors[HAS_ONGOING_MIGRATION] = arg -> new HasOngoingMigration();
constructors[MIGRATION_COMMIT] = arg -> new MigrationCommitOperation();
constructors[PARTITION_STATE_OP] = arg -> new PartitionStateOperation();
constructors[PROMOTION_COMMIT] = arg -> new PromotionCommitOperation();
constructors[REPLICA_SYNC_REQUEST] = arg -> new PartitionReplicaSyncRequest();
constructors[REPLICA_SYNC_RESPONSE] = arg -> new PartitionReplicaSyncResponse();
constructors[REPLICA_SYNC_RETRY_RESPONSE] = arg -> new PartitionReplicaSyncRetryResponse();
constructors[SAFE_STATE_CHECK] = arg -> new SafeStateCheckOperation();
constructors[SHUTDOWN_REQUEST] = arg -> new ShutdownRequestOperation();
constructors[SHUTDOWN_RESPONSE] = arg -> new ShutdownResponseOperation();
constructors[REPLICA_FRAGMENT_MIGRATION_STATE] = arg -> new ReplicaFragmentMigrationState();
constructors[MIGRATION] = arg -> new MigrationOperation();
constructors[MIGRATION_REQUEST] = arg -> new MigrationRequestOperation();
constructors[NON_FRAGMENTED_SERVICE_NAMESPACE] = arg -> NonFragmentedServiceNamespace.INSTANCE;
constructors[PARTITION_REPLICA] = arg -> new PartitionReplica();
constructors[PUBLISH_COMPLETED_MIGRATIONS] = arg -> new PublishCompletedMigrationsOperation();
constructors[PARTITION_STATE_CHECK_OP] = arg -> new PartitionStateCheckOperation();
constructors[REPLICA_MIGRATION_EVENT] = arg -> new ReplicaMigrationEventImpl();
constructors[MIGRATION_EVENT] = arg -> new MigrationStateImpl();
constructors[PARTITION_LOST_EVENT] = arg -> new PartitionLostEventImpl();
constructors[REPLICA_SYNC_REQUEST_OFFLOADABLE] = arg -> new PartitionReplicaSyncRequestOffloadable();
return new ArrayDataSerializableFactory(constructors);
}
use of com.hazelcast.internal.partition.ReplicaMigrationEventImpl in project hazelcast by hazelcast.
the class PartitionEventManager method sendMigrationProcessStartedEvent.
public void sendMigrationProcessStartedEvent(MigrationState state) {
ReplicaMigrationEvent event = new ReplicaMigrationEventImpl(state, MIGRATION_STARTED_PARTITION_ID, 0, null, null, false, 0L);
sendMigrationEvent(event);
}
use of com.hazelcast.internal.partition.ReplicaMigrationEventImpl in project hazelcast by hazelcast.
the class MigrationListenerAdapterTest method test_migrationFailed.
@Test
public void test_migrationFailed() {
MigrationState migrationSchedule = new MigrationStateImpl();
ReplicaMigrationEvent event = new ReplicaMigrationEventImpl(migrationSchedule, 0, 0, null, null, false, 0L);
adapter.onEvent(event);
verify(listener, never()).migrationStarted(any(MigrationState.class));
verify(listener, never()).migrationFinished(any(MigrationState.class));
verify(listener, never()).replicaMigrationCompleted(any(ReplicaMigrationEvent.class));
verify(listener).replicaMigrationFailed(event);
}
use of com.hazelcast.internal.partition.ReplicaMigrationEventImpl in project hazelcast by hazelcast.
the class PartitionEventManager method sendMigrationProcessCompletedEvent.
public void sendMigrationProcessCompletedEvent(MigrationState state) {
ReplicaMigrationEvent event = new ReplicaMigrationEventImpl(state, MIGRATION_FINISHED_PARTITION_ID, 0, null, null, false, 0L);
sendMigrationEvent(event);
}
use of com.hazelcast.internal.partition.ReplicaMigrationEventImpl in project hazelcast by hazelcast.
the class PartitionEventManager method sendMigrationEvent.
/**
* Sends a {@link ReplicaMigrationEvent} to the registered event listeners.
*/
public void sendMigrationEvent(MigrationState state, MigrationInfo migrationInfo, long elapsed) {
ClusterServiceImpl clusterService = node.getClusterService();
PartitionReplica sourceReplica = migrationInfo.getSource();
PartitionReplica destReplica = migrationInfo.getDestination();
Member source = sourceReplica != null ? clusterService.getMember(sourceReplica.address(), sourceReplica.uuid()) : null;
Member destination = clusterService.getMember(destReplica.address(), destReplica.uuid());
int partitionId = migrationInfo.getPartitionId();
int replicaIndex = migrationInfo.getDestinationNewReplicaIndex();
boolean success = migrationInfo.getStatus() == MigrationStatus.SUCCESS;
ReplicaMigrationEvent event = new ReplicaMigrationEventImpl(state, partitionId, replicaIndex, source, destination, success, elapsed);
sendMigrationEvent(event);
}
Aggregations