Search in sources :

Example 1 with SetService

use of com.hazelcast.collection.impl.set.SetService in project hazelcast by hazelcast.

the class ServiceManagerImpl method registerDefaultServices.

private void registerDefaultServices(ServicesConfig servicesConfig) {
    if (!servicesConfig.isEnableDefaults()) {
        return;
    }
    logger.finest("Registering default services...");
    registerService(MapService.SERVICE_NAME, createService(MapService.class));
    registerService(LockSupportService.SERVICE_NAME, new LockSupportServiceImpl(nodeEngine));
    registerService(QueueService.SERVICE_NAME, new QueueService(nodeEngine));
    registerService(TopicService.SERVICE_NAME, new TopicService());
    registerService(ReliableTopicService.SERVICE_NAME, new ReliableTopicService(nodeEngine));
    registerService(MultiMapService.SERVICE_NAME, new MultiMapService(nodeEngine));
    registerService(ListService.SERVICE_NAME, new ListService(nodeEngine));
    registerService(SetService.SERVICE_NAME, new SetService(nodeEngine));
    registerService(DistributedExecutorService.SERVICE_NAME, new DistributedExecutorService());
    registerService(DistributedDurableExecutorService.SERVICE_NAME, new DistributedDurableExecutorService(nodeEngine));
    registerService(FlakeIdGeneratorService.SERVICE_NAME, new FlakeIdGeneratorService(nodeEngine));
    registerService(ReplicatedMapService.SERVICE_NAME, new ReplicatedMapService(nodeEngine));
    registerService(RingbufferService.SERVICE_NAME, new RingbufferService(nodeEngine));
    registerService(XAService.SERVICE_NAME, new XAService(nodeEngine));
    registerService(CardinalityEstimatorService.SERVICE_NAME, new CardinalityEstimatorService());
    registerService(PNCounterService.SERVICE_NAME, new PNCounterService());
    registerService(CRDTReplicationMigrationService.SERVICE_NAME, new CRDTReplicationMigrationService());
    registerService(DistributedScheduledExecutorService.SERVICE_NAME, new DistributedScheduledExecutorService());
    registerService(MetricsService.SERVICE_NAME, new MetricsService(nodeEngine));
    registerCacheServiceIfAvailable();
    readServiceDescriptors();
}
Also used : DistributedDurableExecutorService(com.hazelcast.durableexecutor.impl.DistributedDurableExecutorService) XAService(com.hazelcast.transaction.impl.xa.XAService) CRDTReplicationMigrationService(com.hazelcast.internal.crdt.CRDTReplicationMigrationService) MetricsService(com.hazelcast.internal.metrics.impl.MetricsService) MultiMapService(com.hazelcast.multimap.impl.MultiMapService) SetService(com.hazelcast.collection.impl.set.SetService) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) QueueService(com.hazelcast.collection.impl.queue.QueueService) FlakeIdGeneratorService(com.hazelcast.flakeidgen.impl.FlakeIdGeneratorService) ListService(com.hazelcast.collection.impl.list.ListService) TopicService(com.hazelcast.topic.impl.TopicService) ReliableTopicService(com.hazelcast.topic.impl.reliable.ReliableTopicService) DistributedScheduledExecutorService(com.hazelcast.scheduledexecutor.impl.DistributedScheduledExecutorService) ReliableTopicService(com.hazelcast.topic.impl.reliable.ReliableTopicService) LockSupportServiceImpl(com.hazelcast.internal.locksupport.LockSupportServiceImpl) DistributedExecutorService(com.hazelcast.executor.impl.DistributedExecutorService) RingbufferService(com.hazelcast.ringbuffer.impl.RingbufferService) MultiMapService(com.hazelcast.multimap.impl.MultiMapService) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) MapService(com.hazelcast.map.impl.MapService) PNCounterService(com.hazelcast.internal.crdt.pncounter.PNCounterService) CardinalityEstimatorService(com.hazelcast.cardinality.impl.CardinalityEstimatorService)

Example 2 with SetService

use of com.hazelcast.collection.impl.set.SetService in project hazelcast by hazelcast.

the class PartitionControlledIdTest method testSet.

@Test
public void testSet() {
    String partitionKey = "hazelcast";
    HazelcastInstance hz = getHazelcastInstance(partitionKey);
    ISet<String> set = hz.getSet("set@" + partitionKey);
    set.add("");
    assertEquals("set@" + partitionKey, set.getName());
    assertEquals(partitionKey, set.getPartitionKey());
    SetService service = getNodeEngine(hz).getService(SetService.SERVICE_NAME);
    assertTrue(service.getContainerMap().containsKey(set.getName()));
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) SetService(com.hazelcast.collection.impl.set.SetService) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 3 with SetService

use of com.hazelcast.collection.impl.set.SetService in project hazelcast by hazelcast.

the class SetKeyValueSource method open.

@Override
public boolean open(NodeEngine nodeEngine) {
    NodeEngineImpl nei = (NodeEngineImpl) nodeEngine;
    ss = nei.getSerializationService();
    Address thisAddress = nei.getThisAddress();
    InternalPartitionService ps = nei.getPartitionService();
    Data data = ss.toData(setName, StringAndPartitionAwarePartitioningStrategy.INSTANCE);
    int partitionId = ps.getPartitionId(data);
    Address partitionOwner = ps.getPartitionOwner(partitionId);
    if (partitionOwner == null) {
        return false;
    }
    if (thisAddress.equals(partitionOwner)) {
        SetService setService = nei.getService(SetService.SERVICE_NAME);
        SetContainer setContainer = setService.getOrCreateContainer(setName, false);
        List<CollectionItem> items = new ArrayList<CollectionItem>(setContainer.getCollection());
        iterator = items.iterator();
    }
    return true;
}
Also used : NodeEngineImpl(com.hazelcast.spi.impl.NodeEngineImpl) SetContainer(com.hazelcast.collection.impl.set.SetContainer) Address(com.hazelcast.nio.Address) InternalPartitionService(com.hazelcast.internal.partition.InternalPartitionService) SetService(com.hazelcast.collection.impl.set.SetService) ArrayList(java.util.ArrayList) Data(com.hazelcast.nio.serialization.Data) CollectionItem(com.hazelcast.collection.impl.collection.CollectionItem)

Aggregations

SetService (com.hazelcast.collection.impl.set.SetService)3 CardinalityEstimatorService (com.hazelcast.cardinality.impl.CardinalityEstimatorService)1 CollectionItem (com.hazelcast.collection.impl.collection.CollectionItem)1 ListService (com.hazelcast.collection.impl.list.ListService)1 QueueService (com.hazelcast.collection.impl.queue.QueueService)1 SetContainer (com.hazelcast.collection.impl.set.SetContainer)1 HazelcastInstance (com.hazelcast.core.HazelcastInstance)1 DistributedDurableExecutorService (com.hazelcast.durableexecutor.impl.DistributedDurableExecutorService)1 DistributedExecutorService (com.hazelcast.executor.impl.DistributedExecutorService)1 FlakeIdGeneratorService (com.hazelcast.flakeidgen.impl.FlakeIdGeneratorService)1 CRDTReplicationMigrationService (com.hazelcast.internal.crdt.CRDTReplicationMigrationService)1 PNCounterService (com.hazelcast.internal.crdt.pncounter.PNCounterService)1 LockSupportServiceImpl (com.hazelcast.internal.locksupport.LockSupportServiceImpl)1 MetricsService (com.hazelcast.internal.metrics.impl.MetricsService)1 InternalPartitionService (com.hazelcast.internal.partition.InternalPartitionService)1 MapService (com.hazelcast.map.impl.MapService)1 MultiMapService (com.hazelcast.multimap.impl.MultiMapService)1 Address (com.hazelcast.nio.Address)1 Data (com.hazelcast.nio.serialization.Data)1 ReplicatedMapService (com.hazelcast.replicatedmap.impl.ReplicatedMapService)1