use of com.hazelcast.config.RingbufferConfig in project hazelcast by hazelcast.
the class RingbufferAbstractTest method setup.
@Before
public void setup() {
config = new Config();
config.addRingBufferConfig(new RingbufferConfig("add_overwritingOldData*").setCapacity(5));
config.addRingBufferConfig(new RingbufferConfig("add_manyTimesRoundTheRing*").setCapacity(5));
config.addRingBufferConfig(new RingbufferConfig("readOne_whenBeforeHead*").setCapacity(5));
config.addRingBufferConfig(new RingbufferConfig("readOne_whenObjectInMemoryFormat*").setCapacity(5).setInMemoryFormat(OBJECT));
config.addRingBufferConfig(new RingbufferConfig("readManyAsync_whenEnoughItems_andObjectInMemoryFormat*").setCapacity(5).setInMemoryFormat(OBJECT));
config.addRingBufferConfig(new RingbufferConfig("addAsync_whenOverwrite_andNoTTL*").setCapacity(300).setTimeToLiveSeconds(0));
config.addRingBufferConfig(new RingbufferConfig("addAllAsync_whenCollectionExceedsCapacity*").setCapacity(5));
config.addRingBufferConfig(new RingbufferConfig("addAllAsync_manyTimesRoundTheRing*").setCapacity(50));
config.addRingBufferConfig(new RingbufferConfig("addAllAsync_whenObjectInMemoryFormat*").setCapacity(50).setInMemoryFormat(OBJECT));
config.addRingBufferConfig(new RingbufferConfig("addAsync_fail_whenNoSpace*").setCapacity(300).setTimeToLiveSeconds(10));
config.addRingBufferConfig(new RingbufferConfig("addAsync_whenOverwrite_andTTL*").setCapacity(300));
config.addRingBufferConfig(new RingbufferConfig("addAsync_whenOverwrite_andNoTTL*").setCapacity(300).setTimeToLiveSeconds(0));
config.addRingBufferConfig(new RingbufferConfig("remainingCapacity*").setCapacity(300).setTimeToLiveSeconds(10));
config.addRingBufferConfig(new RingbufferConfig("readOne_staleSequence*").setCapacity(5));
config.addRingBufferConfig(new RingbufferConfig("readOne_futureSequence*").setCapacity(5));
instances = newInstances(config);
local = instances[0];
HazelcastInstance target = instances[instances.length - 1];
name = HazelcastTestSupport.randomNameOwnedBy(target, getTestMethodName());
ringbuffer = local.getRingbuffer(name);
}
use of com.hazelcast.config.RingbufferConfig in project hazelcast by hazelcast.
the class RingbufferService method getContainer.
public RingbufferContainer getContainer(String name) {
RingbufferContainer ringbuffer = containers.get(name);
if (ringbuffer != null) {
return ringbuffer;
}
RingbufferConfig ringbufferConfig = getRingbufferConfig(name);
ringbuffer = new RingbufferContainer(name, ringbufferConfig, nodeEngine.getSerializationService(), nodeEngine.getConfigClassLoader());
ringbuffer.getStore().instrument(nodeEngine);
containers.put(name, ringbuffer);
return ringbuffer;
}
use of com.hazelcast.config.RingbufferConfig in project hazelcast by hazelcast.
the class RingbufferService method addRingbuffer.
public void addRingbuffer(String name, RingbufferContainer ringbuffer) {
checkNotNull(name, "name can't be null");
checkNotNull(ringbuffer, "ringbuffer can't be null");
final RingbufferConfig config = nodeEngine.getConfig().getRingbufferConfig(name);
final SerializationService serializationService = nodeEngine.getSerializationService();
ringbuffer.init(name, config, serializationService, nodeEngine.getConfigClassLoader());
ringbuffer.getStore().instrument(nodeEngine);
containers.put(name, ringbuffer);
}
use of com.hazelcast.config.RingbufferConfig in project hazelcast by hazelcast.
the class RingbufferTest method init.
@Before
public void init() {
Config config = new Config();
config.addRingBufferConfig(new RingbufferConfig("rb*").setCapacity(CAPACITY));
// Set operation timeout to larger than test timeout. So the tests do not pass accidentally because of retries.
// The tests should depend on notifier system, not retrying.
config.setProperty("hazelcast.operation.call.timeout.millis", "305000");
config.getSerializationConfig().addDataSerializableFactory(IdentifiedDataSerializableFactory.FACTORY_ID, new IdentifiedDataSerializableFactory());
server = hazelcastFactory.newHazelcastInstance(config);
ClientConfig clientConfig = new ClientConfig();
clientConfig.getSerializationConfig().addDataSerializableFactory(IdentifiedDataSerializableFactory.FACTORY_ID, new IdentifiedDataSerializableFactory());
client = hazelcastFactory.newHazelcastClient(clientConfig);
String name = "rb-" + randomString();
serverRingbuffer = server.getRingbuffer(name);
clientRingbuffer = client.getRingbuffer(name);
}
use of com.hazelcast.config.RingbufferConfig in project hazelcast by hazelcast.
the class ClientReliableTopicOverloadTest method setupCluster.
@Before
public void setupCluster() {
Config config = new Config();
config.addRingBufferConfig(new RingbufferConfig("when*").setCapacity(100).setTimeToLiveSeconds(Integer.MAX_VALUE));
hazelcastFactory.newHazelcastInstance(config);
ClientConfig clientConfig = new ClientConfig();
clientConfig.addReliableTopicConfig(new ClientReliableTopicConfig("whenError_*").setTopicOverloadPolicy(TopicOverloadPolicy.ERROR));
clientConfig.addReliableTopicConfig(new ClientReliableTopicConfig("whenDiscardOldest_*").setTopicOverloadPolicy(TopicOverloadPolicy.DISCARD_OLDEST));
clientConfig.addReliableTopicConfig(new ClientReliableTopicConfig("whenDiscardNewest_*").setTopicOverloadPolicy(TopicOverloadPolicy.DISCARD_NEWEST));
clientConfig.addReliableTopicConfig(new ClientReliableTopicConfig("whenBlock_*").setTopicOverloadPolicy(TopicOverloadPolicy.BLOCK));
HazelcastInstance client = hazelcastFactory.newHazelcastClient(clientConfig);
serializationService = ((HazelcastClientProxy) client).getSerializationService();
String topicName = getTestMethodName();
topic = client.<String>getReliableTopic(topicName);
ringbuffer = ((ClientReliableTopicProxy<String>) topic).getRingbuffer();
}
Aggregations