com.hazelcast.map.impl.mapstore.writebehind
Interface WriteBehindQueue<E>

Type Parameters:
E - the type of element to be stored in this queue.

public interface WriteBehindQueue<E>

A specific queue implementation which is used for write-behind-store operations. Also supports some filtering methods e.g. getFrontByTime(long, java.util.Collection), getFrontByNumber(int, java.util.Collection)


Method Summary
 void addFirst(Collection<E> collection)
          Inserts collection of elements to the front of this queue.
 void addLast(E e)
          Inserts to the end of this queue.
 List<E> asList()
          Returns a read-only list representation of this queue.
 void clear()
          Removes all of the elements in this WriteBehindQueue Queue will be empty after this method returns.
 boolean contains(E e)
          Checks whether an element exist in this queue.
 int drainTo(Collection<E> collection)
          Removes all elements from this queue and adds them to the given collection.
 void getFrontByNumber(int numberOfElements, Collection<E> collection)
          Adds the given number of elements to the supplied collection by starting from the head of this queue.
 void getFrontByTime(long time, Collection<E> collection)
          Adds all elements to the supplied collection which are smaller than or equal to the given time.
 boolean removeFirstOccurrence(E e)
          Removes the first occurrence of the specified element in this queue when searching it by starting from the head of this queue.
 int size()
          Returns the number of elements in this WriteBehindQueue.
 

Method Detail

addFirst

void addFirst(Collection<E> collection)
Inserts collection of elements to the front of this queue.

Parameters:
collection - collection of elements to be inserted in front of this queue.

addLast

void addLast(E e)
Inserts to the end of this queue.

Parameters:
e - element to be offered

removeFirstOccurrence

boolean removeFirstOccurrence(E e)
Removes the first occurrence of the specified element in this queue when searching it by starting from the head of this queue.

Parameters:
e - element to be removed.
Returns:
true if removed successfully, false otherwise

drainTo

int drainTo(Collection<E> collection)
Removes all elements from this queue and adds them to the given collection.

Parameters:
collection - all elements to be added to this collection.
Returns:
number of removed items from this queue.

contains

boolean contains(E e)
Checks whether an element exist in this queue.

Parameters:
e - item to be checked
Returns:
true if exists, false otherwise

size

int size()
Returns the number of elements in this WriteBehindQueue.

Returns:
the number of elements in this WriteBehindQueue.

clear

void clear()
Removes all of the elements in this WriteBehindQueue Queue will be empty after this method returns.


asList

List<E> asList()
Returns a read-only list representation of this queue.

Returns:
read-only list representation of this queue.

getFrontByTime

void getFrontByTime(long time,
                    Collection<E> collection)
Adds all elements to the supplied collection which are smaller than or equal to the given time. Finds elements which's delayed times were elapsed. Used in usual flow of write-behind execution.

Parameters:
time - given time.
collection - all found elements will be added to this collection.

getFrontByNumber

void getFrontByNumber(int numberOfElements,
                      Collection<E> collection)
Adds the given number of elements to the supplied collection by starting from the head of this queue. If there is a need to immediately flush some number of elements from this queue, this method will be used.

Parameters:
numberOfElements - get this number of elements from the start of this queue.
collection - all found elements will be added to this collection.


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.