use of com.hazelcast.config.RingbufferConfig in project hazelcast by hazelcast.
the class Issue7317Test method setup.
@Before
public void setup() {
Config serverConfig = new Config();
RingbufferConfig rbConf = new RingbufferConfig(smallRB);
rbConf.setCapacity(smallRBCapacity);
serverConfig.addRingBufferConfig(rbConf);
hazelcastFactory.newHazelcastInstance(serverConfig);
ClientConfig config = new ClientConfig();
config.getReliableTopicConfig(smallRB).setReadBatchSize(smallRBCapacity);
client = hazelcastFactory.newHazelcastClient(config);
}
use of com.hazelcast.config.RingbufferConfig in project hazelcast by hazelcast.
the class ClientReliableTopicBlockTest method setup.
@Before
public void setup() {
Config config = smallInstanceConfig();
config.addRingBufferConfig(new RingbufferConfig("blockingReliableTopic*").setCapacity(10).setTimeToLiveSeconds(60));
hazelcastFactory.newHazelcastInstance(config);
ClientConfig clientConfig = new ClientConfig().addReliableTopicConfig(new ClientReliableTopicConfig("blockingReliableTopic*").setReadBatchSize(10).setTopicOverloadPolicy(TopicOverloadPolicy.BLOCK));
client = hazelcastFactory.newHazelcastClient(clientConfig);
}
use of com.hazelcast.config.RingbufferConfig in project hazelcast by hazelcast.
the class TestFullApplicationContext method testRingbufferConfig.
@Test
public void testRingbufferConfig() {
RingbufferConfig testRingbuffer = config.getRingbufferConfig("testRingbuffer");
assertNotNull(testRingbuffer);
assertEquals("testRingbuffer", testRingbuffer.getName());
assertEquals(InMemoryFormat.OBJECT, testRingbuffer.getInMemoryFormat());
assertEquals(100, testRingbuffer.getCapacity());
assertEquals(1, testRingbuffer.getBackupCount());
assertEquals(1, testRingbuffer.getAsyncBackupCount());
assertEquals(20, testRingbuffer.getTimeToLiveSeconds());
RingbufferStoreConfig store1 = testRingbuffer.getRingbufferStoreConfig();
assertNotNull(store1);
assertEquals(DummyRingbufferStore.class.getName(), store1.getClassName());
MergePolicyConfig mergePolicyConfig = testRingbuffer.getMergePolicyConfig();
assertNotNull(mergePolicyConfig);
assertEquals("PassThroughMergePolicy", mergePolicyConfig.getPolicy());
assertEquals(2342, mergePolicyConfig.getBatchSize());
RingbufferConfig testRingbuffer2 = config.getRingbufferConfig("testRingbuffer2");
assertNotNull(testRingbuffer2);
RingbufferStoreConfig store2 = testRingbuffer2.getRingbufferStoreConfig();
assertNotNull(store2);
assertEquals(DummyRingbufferStoreFactory.class.getName(), store2.getFactoryClassName());
assertFalse(store2.getProperties().isEmpty());
assertEquals("value", store2.getProperty("dummy.property"));
assertEquals("value2", store2.getProperty("dummy.property.2"));
RingbufferConfig testRingbuffer3 = config.getRingbufferConfig("testRingbuffer3");
assertNotNull(testRingbuffer3);
RingbufferStoreConfig store3 = testRingbuffer3.getRingbufferStoreConfig();
assertNotNull(store3);
assertEquals(dummyRingbufferStore, store3.getStoreImplementation());
RingbufferConfig testRingbuffer4 = config.getRingbufferConfig("testRingbuffer4");
assertNotNull(testRingbuffer4);
RingbufferStoreConfig store4 = testRingbuffer4.getRingbufferStoreConfig();
assertNotNull(store4);
assertEquals(dummyRingbufferStoreFactory, store4.getFactoryImplementation());
}
use of com.hazelcast.config.RingbufferConfig in project hazelcast by hazelcast.
the class RingbufferService method createDistributedObject.
@Override
public DistributedObject createDistributedObject(String objectName, UUID source, boolean local) {
RingbufferConfig ringbufferConfig = getRingbufferConfig(objectName);
checkRingbufferConfig(ringbufferConfig, nodeEngine.getSplitBrainMergePolicyProvider());
return new RingbufferProxy(nodeEngine, this, objectName, ringbufferConfig);
}
use of com.hazelcast.config.RingbufferConfig in project hazelcast by hazelcast.
the class MergeOperation method merge.
/**
* Merges the provided {@code mergingValue} into the {@code existingContainer}
* and returns the merged ringbuffer.
*
* @param existingContainer the container into which to merge the data
* @param mergingValue the data to merge
* @return the merged ringbuffer
*/
private Ringbuffer<Object> merge(RingbufferContainer<Object, Object> existingContainer, RingbufferMergeTypes mergingValue) {
RingbufferMergeTypes existingValue = createMergingValueOrNull(existingContainer);
RingbufferMergeData resultData = mergePolicy.merge(mergingValue, existingValue);
if (resultData == null) {
ringbufferService.destroyDistributedObject(namespace.getObjectName());
return null;
} else {
if (existingContainer == null) {
RingbufferConfig config = getRingbufferConfig(ringbufferService, namespace);
existingContainer = ringbufferService.getOrCreateContainer(getPartitionId(), namespace, config);
}
setRingbufferData(resultData, existingContainer);
return existingContainer.getRingbuffer();
}
}
Aggregations