use of com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry in project hazelcast by hazelcast.
the class CoalescedWriteBehindQueue method addFirst.
@Override
public void addFirst(Collection<DelayedEntry> collection) {
if (isEmpty(collection)) {
return;
}
int expectedCapacity = map.size() + collection.size();
Map<Data, DelayedEntry> newMap = createMapWithExpectedCapacity(expectedCapacity);
for (DelayedEntry next : collection) {
newMap.put((Data) next.getKey(), next);
}
newMap.putAll(map);
map = newMap;
}
use of com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry in project hazelcast by hazelcast.
the class CyclicWriteBehindQueue method removeFirstOccurrence.
/**
* Removes the first element of this queue instead of searching for it,
* implementation of this method is strongly tied with {@link StoreWorker} implementation.
*
* @param entry element to be removed.
* @return <code>true</code> if removed successfully, <code>false</code> otherwise
*/
@Override
public boolean removeFirstOccurrence(DelayedEntry entry) {
DelayedEntry removedEntry = deque.pollFirst();
if (removedEntry == null) {
return false;
}
decreaseCountIndex(entry);
return true;
}
use of com.hazelcast.map.impl.mapstore.writebehind.entry.DelayedEntry in project hazelcast by hazelcast.
the class WriteBehindStateHolder method writeData.
@Override
public void writeData(ObjectDataOutput out) throws IOException {
MapService mapService = mapReplicationOperation.getService();
MapServiceContext mapServiceContext = mapService.getMapServiceContext();
out.writeInt(delayedEntries.size());
for (Map.Entry<String, List<DelayedEntry>> entry : delayedEntries.entrySet()) {
out.writeUTF(entry.getKey());
List<DelayedEntry> delayedEntryList = entry.getValue();
out.writeInt(delayedEntryList.size());
for (DelayedEntry e : delayedEntryList) {
Data key = mapServiceContext.toData(e.getKey());
Data value = mapServiceContext.toData(e.getValue());
out.writeData(key);
out.writeData(value);
out.writeLong(e.getStoreTime());
out.writeInt(e.getPartitionId());
out.writeLong(e.getSequence());
}
}
out.writeInt(flushSequences.size());
for (Map.Entry<String, Queue<WriteBehindStore.Sequence>> entry : flushSequences.entrySet()) {
out.writeUTF(entry.getKey());
Queue<WriteBehindStore.Sequence> queue = entry.getValue();
out.writeInt(queue.size());
for (WriteBehindStore.Sequence sequence : queue) {
out.writeLong(sequence.getSequence());
out.writeBoolean(sequence.isFullFlush());
}
}
}
Aggregations