Search in sources :

Example 1 with RingbufferService

use of com.hazelcast.ringbuffer.impl.RingbufferService in project hazelcast by hazelcast.

the class ReplicationOperation method run.

@Override
public void run() {
    RingbufferService service = getService();
    for (Map.Entry<String, RingbufferContainer> entry : migrationData.entrySet()) {
        String name = entry.getKey();
        RingbufferContainer ringbuffer = entry.getValue();
        service.addRingbuffer(name, ringbuffer);
    }
}
Also used : RingbufferContainer(com.hazelcast.ringbuffer.impl.RingbufferContainer) RingbufferService(com.hazelcast.ringbuffer.impl.RingbufferService) Map(java.util.Map) HashMap(java.util.HashMap)

Example 2 with RingbufferService

use of com.hazelcast.ringbuffer.impl.RingbufferService 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(LockService.SERVICE_NAME, new LockServiceImpl(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(AtomicLongService.SERVICE_NAME, new AtomicLongService());
    registerService(AtomicReferenceService.SERVICE_NAME, new AtomicReferenceService());
    registerService(CountDownLatchService.SERVICE_NAME, new CountDownLatchService());
    registerService(SemaphoreService.SERVICE_NAME, new SemaphoreService(nodeEngine));
    registerService(IdGeneratorService.SERVICE_NAME, new IdGeneratorService(nodeEngine));
    registerService(MapReduceService.SERVICE_NAME, new MapReduceService(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(DistributedScheduledExecutorService.SERVICE_NAME, new DistributedScheduledExecutorService());
    registerCacheServiceIfAvailable();
    readServiceDescriptors();
}
Also used : DistributedDurableExecutorService(com.hazelcast.durableexecutor.impl.DistributedDurableExecutorService) XAService(com.hazelcast.transaction.impl.xa.XAService) SemaphoreService(com.hazelcast.concurrent.semaphore.SemaphoreService) MultiMapService(com.hazelcast.multimap.impl.MultiMapService) LockServiceImpl(com.hazelcast.concurrent.lock.LockServiceImpl) SetService(com.hazelcast.collection.impl.set.SetService) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) QueueService(com.hazelcast.collection.impl.queue.QueueService) IdGeneratorService(com.hazelcast.concurrent.idgen.IdGeneratorService) 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) AtomicLongService(com.hazelcast.concurrent.atomiclong.AtomicLongService) DistributedExecutorService(com.hazelcast.executor.impl.DistributedExecutorService) CountDownLatchService(com.hazelcast.concurrent.countdownlatch.CountDownLatchService) MapReduceService(com.hazelcast.mapreduce.impl.MapReduceService) RingbufferService(com.hazelcast.ringbuffer.impl.RingbufferService) MultiMapService(com.hazelcast.multimap.impl.MultiMapService) ReplicatedMapService(com.hazelcast.replicatedmap.impl.ReplicatedMapService) MapService(com.hazelcast.map.impl.MapService) CardinalityEstimatorService(com.hazelcast.cardinality.impl.CardinalityEstimatorService) AtomicReferenceService(com.hazelcast.concurrent.atomicreference.AtomicReferenceService)

Example 3 with RingbufferService

use of com.hazelcast.ringbuffer.impl.RingbufferService in project hazelcast by hazelcast.

the class PartitionControlledIdTest method testRingbuffer.

@Test
public void testRingbuffer() throws Exception {
    String partitionKey = "hazelcast";
    HazelcastInstance hz = getHazelcastInstance(partitionKey);
    Ringbuffer ringbuffer = hz.getRingbuffer("ringbuffer@" + partitionKey);
    ringbuffer.add("foo");
    assertEquals("ringbuffer@" + partitionKey, ringbuffer.getName());
    assertEquals(partitionKey, ringbuffer.getPartitionKey());
    RingbufferService service = getNodeEngine(hz).getService(RingbufferService.SERVICE_NAME);
    assertTrue(service.getContainers().containsKey(ringbuffer.getName()));
}
Also used : HazelcastInstance(com.hazelcast.core.HazelcastInstance) Ringbuffer(com.hazelcast.ringbuffer.Ringbuffer) RingbufferService(com.hazelcast.ringbuffer.impl.RingbufferService) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 4 with RingbufferService

use of com.hazelcast.ringbuffer.impl.RingbufferService in project hazelcast by hazelcast.

the class ReliableTopicCreateTest method testConstruction.

@Test
public void testConstruction() {
    HazelcastInstance hz = createHazelcastInstance();
    RingbufferService ringbufferService = getNodeEngineImpl(hz).getService(RingbufferService.SERVICE_NAME);
    ReliableTopicProxy<String> topic = (ReliableTopicProxy<String>) hz.<String>getReliableTopic("foo");
    Ringbuffer ringbuffer = hz.getRingbuffer(RingbufferService.TOPIC_RB_PREFIX + "foo");
    assertSame(ringbuffer, topic.ringbuffer);
    // make sure the ringbuffer and topic are hooked up correctly
    topic.publish("item1");
    topic.publish("item2");
    assertEquals(0, ringbuffer.headSequence());
    assertEquals(1, ringbuffer.tailSequence());
    ConcurrentMap<String, RingbufferContainer> containers = ringbufferService.getContainers();
    assertEquals(1, containers.size());
    assertTrue(containers.containsKey(ringbuffer.getName()));
}
Also used : RingbufferContainer(com.hazelcast.ringbuffer.impl.RingbufferContainer) HazelcastInstance(com.hazelcast.core.HazelcastInstance) Ringbuffer(com.hazelcast.ringbuffer.Ringbuffer) RingbufferService(com.hazelcast.ringbuffer.impl.RingbufferService) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Example 5 with RingbufferService

use of com.hazelcast.ringbuffer.impl.RingbufferService in project hazelcast by hazelcast.

the class ReliableTopicCreateTest method testRingbufferConfiguration.

@Test
public void testRingbufferConfiguration() {
    Config config = new Config();
    RingbufferConfig rbConfig = new RingbufferConfig("foo").setCapacity(21);
    config.addRingBufferConfig(rbConfig);
    HazelcastInstance hz = createHazelcastInstance(config);
    RingbufferService ringbufferService = getNodeEngineImpl(hz).getService(RingbufferService.SERVICE_NAME);
    ReliableTopicProxy topic = (ReliableTopicProxy) hz.getReliableTopic("foo");
    Ringbuffer ringbuffer = hz.getRingbuffer(RingbufferService.TOPIC_RB_PREFIX + "foo");
    assertSame(ringbuffer, topic.ringbuffer);
    assertEquals(21, ringbuffer.capacity());
    // triggers the creation
    ringbuffer.size();
    ConcurrentMap<String, RingbufferContainer> containers = ringbufferService.getContainers();
    assertEquals(1, containers.size());
    assertTrue(containers.containsKey(ringbuffer.getName()));
    RingbufferContainer container = containers.get(ringbuffer.getName());
    assertEquals(rbConfig.getCapacity(), container.getConfig().getCapacity());
}
Also used : RingbufferContainer(com.hazelcast.ringbuffer.impl.RingbufferContainer) HazelcastInstance(com.hazelcast.core.HazelcastInstance) ReliableTopicConfig(com.hazelcast.config.ReliableTopicConfig) ListenerConfig(com.hazelcast.config.ListenerConfig) RingbufferConfig(com.hazelcast.config.RingbufferConfig) Config(com.hazelcast.config.Config) Ringbuffer(com.hazelcast.ringbuffer.Ringbuffer) RingbufferConfig(com.hazelcast.config.RingbufferConfig) RingbufferService(com.hazelcast.ringbuffer.impl.RingbufferService) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test) ParallelTest(com.hazelcast.test.annotation.ParallelTest)

Aggregations

RingbufferService (com.hazelcast.ringbuffer.impl.RingbufferService)10 Config (com.hazelcast.config.Config)5 RingbufferConfig (com.hazelcast.config.RingbufferConfig)5 HazelcastInstance (com.hazelcast.core.HazelcastInstance)4 Ringbuffer (com.hazelcast.ringbuffer.Ringbuffer)4 RingbufferContainer (com.hazelcast.ringbuffer.impl.RingbufferContainer)4 ParallelTest (com.hazelcast.test.annotation.ParallelTest)4 QuickTest (com.hazelcast.test.annotation.QuickTest)4 Test (org.junit.Test)4 Before (org.junit.Before)3 ListenerConfig (com.hazelcast.config.ListenerConfig)2 ReliableTopicConfig (com.hazelcast.config.ReliableTopicConfig)2 CardinalityEstimatorService (com.hazelcast.cardinality.impl.CardinalityEstimatorService)1 ListService (com.hazelcast.collection.impl.list.ListService)1 QueueService (com.hazelcast.collection.impl.queue.QueueService)1 SetService (com.hazelcast.collection.impl.set.SetService)1 AtomicLongService (com.hazelcast.concurrent.atomiclong.AtomicLongService)1 AtomicReferenceService (com.hazelcast.concurrent.atomicreference.AtomicReferenceService)1 CountDownLatchService (com.hazelcast.concurrent.countdownlatch.CountDownLatchService)1 IdGeneratorService (com.hazelcast.concurrent.idgen.IdGeneratorService)1