use of com.hazelcast.spi.impl.servicemanager.ServiceInfo 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.servicemanager.ServiceInfo in project hazelcast by hazelcast.
the class ServiceManagerImplTest method getServiceInfo_notExisting.
@Test
public void getServiceInfo_notExisting() {
ServiceInfo result = serviceManager.getServiceInfo("notexisting");
assertNull(result);
}
use of com.hazelcast.spi.impl.servicemanager.ServiceInfo in project hazelcast by hazelcast.
the class ServiceManagerImplTest method getServiceInfo.
// ===================== getServiceInfo ================================
@Test
public void getServiceInfo() {
ServiceInfo result = serviceManager.getServiceInfo(MapService.SERVICE_NAME);
assertNotNull(result);
assertEquals(MapService.SERVICE_NAME, result.getName());
assertInstanceOf(MapService.class, result.getService());
}
use of com.hazelcast.spi.impl.servicemanager.ServiceInfo in project hazelcast by hazelcast.
the class AbstractPartitionOperation method createFragmentReplicationOperationsOffload.
/**
* Used for partition replica sync, supporting
* offloaded replication-operation preparation
*/
final Collection<Operation> createFragmentReplicationOperationsOffload(PartitionReplicationEvent event, ServiceNamespace ns) {
assert !(ns instanceof NonFragmentedServiceNamespace) : ns + " should be used only for fragmented services!";
Collection<Operation> operations = emptySet();
NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
Collection<ServiceInfo> services = nodeEngine.getServiceInfos(FragmentedMigrationAwareService.class);
for (ServiceInfo serviceInfo : services) {
FragmentedMigrationAwareService service = serviceInfo.getService();
if (!service.isKnownServiceNamespace(ns)) {
continue;
}
operations = collectReplicationOperations(event, ns, isRunningOnPartitionThread(), operations, serviceInfo.getName(), service);
}
return operations;
}
use of com.hazelcast.spi.impl.servicemanager.ServiceInfo in project hazelcast by hazelcast.
the class AbstractPartitionOperation method createFragmentReplicationOperations.
final Collection<Operation> createFragmentReplicationOperations(PartitionReplicationEvent event, ServiceNamespace ns) {
assert !(ns instanceof NonFragmentedServiceNamespace) : ns + " should be used only for fragmented services!";
assertRunningOnPartitionThread();
Collection<Operation> operations = emptySet();
NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
Collection<ServiceInfo> services = nodeEngine.getServiceInfos(FragmentedMigrationAwareService.class);
for (ServiceInfo serviceInfo : services) {
FragmentedMigrationAwareService service = serviceInfo.getService();
if (!service.isKnownServiceNamespace(ns)) {
continue;
}
operations = prepareAndAppendReplicationOperation(event, ns, service, serviceInfo.getName(), operations);
}
return operations;
}
Aggregations