use of com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry in project hazelcast by hazelcast.
the class DefaultRecordStore method updateStoreStats.
private void updateStoreStats() {
if (!(mapDataStore instanceof WriteBehindStore) || !mapContainer.getMapConfig().isStatisticsEnabled()) {
return;
}
long now = Clock.currentTimeMillis();
WriteBehindQueue<DelayedEntry> writeBehindQueue = ((WriteBehindStore) mapDataStore).getWriteBehindQueue();
List<DelayedEntry> delayedEntries = writeBehindQueue.asList();
for (DelayedEntry delayedEntry : delayedEntries) {
Record record = getRecordOrNull(toData(delayedEntry.getKey()), now, false);
onStore(record);
}
}
use of com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry in project hazelcast by hazelcast.
the class WriteBehindQueueTest method testWBQ_counter_is_zero.
@Test
public void testWBQ_counter_is_zero() {
final AtomicInteger counter = new AtomicInteger(0);
final WriteBehindQueue<DelayedEntry> queue = createBoundedWBQ(counter);
addEnd(1000, queue);
queue.clear();
assertEquals(0, counter.intValue());
}
use of com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry in project hazelcast by hazelcast.
the class WriteBehindQueueTest method createDelayedEntryList.
private List<DelayedEntry> createDelayedEntryList(int numberOfEntriesToCreate) {
final List<DelayedEntry> list = new ArrayList<DelayedEntry>(numberOfEntriesToCreate);
SerializationService ss1 = new DefaultSerializationServiceBuilder().build();
final long storeTime = Clock.currentTimeMillis();
for (int i = 0; i < numberOfEntriesToCreate; i++) {
final DelayedEntry<Data, Object> e = DelayedEntries.createWithoutValue(ss1.toData(i), storeTime, i);
list.add(e);
}
return list;
}
use of com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry in project hazelcast by hazelcast.
the class WriteBehindQueueTest method testCounter_offer_thenRemove.
@Test
public void testCounter_offer_thenRemove() {
final AtomicInteger counter = new AtomicInteger(0);
final WriteBehindQueue<DelayedEntry> queue = createBoundedWBQ(counter);
addEnd(1000, queue);
queue.drainTo(new ArrayList<DelayedEntry>(1000));
assertEquals(0, counter.intValue());
}
use of com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry in project hazelcast by hazelcast.
the class WriteBehindQueueTest method testWBQMaxSizeException_withMultipleWBQ.
@Test(expected = ReachedMaxSizeException.class)
public void testWBQMaxSizeException_withMultipleWBQ() {
final AtomicInteger counter = new AtomicInteger(0);
final WriteBehindQueue<DelayedEntry> queue1 = createBoundedWBQ(counter);
final WriteBehindQueue<DelayedEntry> queue2 = createBoundedWBQ(counter);
final WriteBehindQueue<DelayedEntry> queue3 = createBoundedWBQ(counter);
final WriteBehindQueue<DelayedEntry> queue4 = createBoundedWBQ(counter);
// put total 1001 items. Max allowed is 1000
addEnd(10, queue1);
addEnd(500, queue2);
addEnd(400, queue3);
addEnd(91, queue4);
}
Aggregations