Search in sources :

Example 1 with RemoteService

use of com.hazelcast.internal.services.RemoteService in project hazelcast by hazelcast.

the class AbstractMapServiceFactory method createMapService.

/**
 * Returns a {@link MapService} object by populating it with required
 * auxiliary services.
 *
 * @return {@link MapService} object
 */
@Override
public MapService createMapService() {
    NodeEngine nodeEngine = getNodeEngine();
    MapServiceContext mapServiceContext = getMapServiceContext();
    ManagedService managedService = createManagedService();
    CountingMigrationAwareService migrationAwareService = createMigrationAwareService();
    TransactionalService transactionalService = createTransactionalService();
    RemoteService remoteService = createRemoteService();
    EventPublishingService eventPublishingService = createEventPublishingService();
    PostJoinAwareService postJoinAwareService = createPostJoinAwareService();
    SplitBrainHandlerService splitBrainHandlerService = createSplitBrainHandlerService();
    WanSupportingService wanSupportingService = createReplicationSupportingService();
    StatisticsAwareService statisticsAwareService = createStatisticsAwareService();
    PartitionAwareService partitionAwareService = createPartitionAwareService();
    MapSplitBrainProtectionAwareService splitBrainProtectionAwareService = createSplitBrainProtectionAwareService();
    ClientAwareService clientAwareService = createClientAwareService();
    checkNotNull(nodeEngine, "nodeEngine should not be null");
    checkNotNull(mapServiceContext, "mapServiceContext should not be null");
    checkNotNull(managedService, "managedService should not be null");
    checkNotNull(migrationAwareService, "migrationAwareService should not be null");
    checkNotNull(transactionalService, "transactionalService should not be null");
    checkNotNull(remoteService, "remoteService should not be null");
    checkNotNull(eventPublishingService, "eventPublishingService should not be null");
    checkNotNull(postJoinAwareService, "postJoinAwareService should not be null");
    checkNotNull(splitBrainHandlerService, "splitBrainHandlerService should not be null");
    checkNotNull(wanSupportingService, "replicationSupportingService should not be null");
    checkNotNull(statisticsAwareService, "statisticsAwareService should not be null");
    checkNotNull(partitionAwareService, "partitionAwareService should not be null");
    checkNotNull(splitBrainProtectionAwareService, "splitBrainProtectionAwareService should not be null");
    checkNotNull(clientAwareService, "clientAwareService should not be null");
    MapService mapService = new MapService();
    mapService.managedService = managedService;
    mapService.migrationAwareService = migrationAwareService;
    mapService.transactionalService = transactionalService;
    mapService.remoteService = remoteService;
    mapService.eventPublishingService = eventPublishingService;
    mapService.postJoinAwareService = postJoinAwareService;
    mapService.splitBrainHandlerService = splitBrainHandlerService;
    mapService.wanSupportingService = wanSupportingService;
    mapService.statisticsAwareService = statisticsAwareService;
    mapService.mapServiceContext = mapServiceContext;
    mapService.partitionAwareService = partitionAwareService;
    mapService.splitBrainProtectionAwareService = splitBrainProtectionAwareService;
    mapService.clientAwareService = clientAwareService;
    mapServiceContext.setService(mapService);
    return mapService;
}
Also used : ManagedService(com.hazelcast.internal.services.ManagedService) StatisticsAwareService(com.hazelcast.internal.services.StatisticsAwareService) TransactionalService(com.hazelcast.internal.services.TransactionalService) CountingMigrationAwareService(com.hazelcast.spi.impl.CountingMigrationAwareService) NodeEngine(com.hazelcast.spi.impl.NodeEngine) ClientAwareService(com.hazelcast.internal.services.ClientAwareService) PostJoinAwareService(com.hazelcast.internal.services.PostJoinAwareService) RemoteService(com.hazelcast.internal.services.RemoteService) WanSupportingService(com.hazelcast.internal.services.WanSupportingService) SplitBrainHandlerService(com.hazelcast.internal.services.SplitBrainHandlerService) PartitionAwareService(com.hazelcast.internal.partition.PartitionAwareService) EventPublishingService(com.hazelcast.spi.impl.eventservice.EventPublishingService)

Example 2 with RemoteService

use of com.hazelcast.internal.services.RemoteService in project hazelcast by hazelcast.

the class ProxyServiceImpl method destroyLocalDistributedObject.

@Override
public void destroyLocalDistributedObject(String serviceName, String name, UUID source, boolean fireEvent) {
    ProxyRegistry registry = registries.get(serviceName);
    if (registry != null) {
        registry.destroyProxy(name, source, fireEvent);
        destroyedCounter.inc();
    }
    RemoteService service = nodeEngine.getService(serviceName);
    service.destroyDistributedObject(name);
    String message = "DistributedObject[" + service + " -> " + name + "] has been destroyed!";
    Throwable cause = new DistributedObjectDestroyedException(message);
    nodeEngine.getOperationParker().cancelParkedOperations(serviceName, name, cause);
}
Also used : DistributedObjectDestroyedException(com.hazelcast.spi.exception.DistributedObjectDestroyedException) RemoteService(com.hazelcast.internal.services.RemoteService)

Example 3 with RemoteService

use of com.hazelcast.internal.services.RemoteService in project hazelcast by hazelcast.

the class MapContainerCreationUponDestroyStressTest method getMapServiceContext.

private MapServiceContext getMapServiceContext(IMap map) {
    MapProxyImpl mapProxy = (MapProxyImpl) map;
    RemoteService service = mapProxy.getService();
    MapService mapService = (MapService) service;
    return mapService.getMapServiceContext();
}
Also used : RemoteService(com.hazelcast.internal.services.RemoteService) MapProxyImpl(com.hazelcast.map.impl.proxy.MapProxyImpl) MapService(com.hazelcast.map.impl.MapService)

Example 4 with RemoteService

use of com.hazelcast.internal.services.RemoteService in project hazelcast by hazelcast.

the class CollectionMergeOperation method merge.

private Collection<CollectionItem> merge(CollectionContainer container, CollectionMergeTypes<Object> mergingValue, SplitBrainMergePolicy<Collection<Object>, CollectionMergeTypes<Object>, Collection<Object>> mergePolicy) {
    SerializationService serializationService = getNodeEngine().getSerializationService();
    mergingValue = (CollectionMergeTypes<Object>) serializationService.getManagedContext().initialize(mergingValue);
    mergePolicy = (SplitBrainMergePolicy<Collection<Object>, CollectionMergeTypes<Object>, Collection<Object>>) serializationService.getManagedContext().initialize(mergePolicy);
    Collection<CollectionItem> existingItems = container.getCollection();
    CollectionMergeTypes<Object> existingValue = createMergingValueOrNull(serializationService, existingItems);
    Collection<Object> newValues = mergePolicy.merge(mergingValue, existingValue);
    if (isEmpty(newValues)) {
        RemoteService service = getService();
        service.destroyDistributedObject(name);
    } else if (existingValue == null) {
        createNewCollectionItems(container, existingItems, newValues, serializationService);
    } else if (!newValues.equals(existingValue.getRawValue())) {
        container.clear(false);
        createNewCollectionItems(container, existingItems, newValues, serializationService);
    }
    return existingItems;
}
Also used : RemoteService(com.hazelcast.internal.services.RemoteService) SerializationService(com.hazelcast.internal.serialization.SerializationService) Collection(java.util.Collection) CollectionItem(com.hazelcast.collection.impl.collection.CollectionItem) CollectionMergeTypes(com.hazelcast.spi.merge.SplitBrainMergeTypes.CollectionMergeTypes)

Example 5 with RemoteService

use of com.hazelcast.internal.services.RemoteService in project hazelcast by hazelcast.

the class CollectionMergeBackupOperation method run.

@Override
public void run() throws Exception {
    CollectionContainer container = getOrCreateContainer();
    if (backupItems.isEmpty()) {
        RemoteService service = getService();
        service.destroyDistributedObject(name);
    } else {
        Map<Long, CollectionItem> backupMap = container.getMap();
        backupMap.clear();
        for (CollectionItem backupItem : backupItems) {
            backupMap.put(backupItem.getItemId(), backupItem);
        }
    }
}
Also used : RemoteService(com.hazelcast.internal.services.RemoteService) CollectionContainer(com.hazelcast.collection.impl.collection.CollectionContainer) CollectionItem(com.hazelcast.collection.impl.collection.CollectionItem)

Aggregations

RemoteService (com.hazelcast.internal.services.RemoteService)5 CollectionItem (com.hazelcast.collection.impl.collection.CollectionItem)2 CollectionContainer (com.hazelcast.collection.impl.collection.CollectionContainer)1 PartitionAwareService (com.hazelcast.internal.partition.PartitionAwareService)1 SerializationService (com.hazelcast.internal.serialization.SerializationService)1 ClientAwareService (com.hazelcast.internal.services.ClientAwareService)1 ManagedService (com.hazelcast.internal.services.ManagedService)1 PostJoinAwareService (com.hazelcast.internal.services.PostJoinAwareService)1 SplitBrainHandlerService (com.hazelcast.internal.services.SplitBrainHandlerService)1 StatisticsAwareService (com.hazelcast.internal.services.StatisticsAwareService)1 TransactionalService (com.hazelcast.internal.services.TransactionalService)1 WanSupportingService (com.hazelcast.internal.services.WanSupportingService)1 MapService (com.hazelcast.map.impl.MapService)1 MapProxyImpl (com.hazelcast.map.impl.proxy.MapProxyImpl)1 DistributedObjectDestroyedException (com.hazelcast.spi.exception.DistributedObjectDestroyedException)1 CountingMigrationAwareService (com.hazelcast.spi.impl.CountingMigrationAwareService)1 NodeEngine (com.hazelcast.spi.impl.NodeEngine)1 EventPublishingService (com.hazelcast.spi.impl.eventservice.EventPublishingService)1 CollectionMergeTypes (com.hazelcast.spi.merge.SplitBrainMergeTypes.CollectionMergeTypes)1 Collection (java.util.Collection)1