Class NotificationManagerPriorityQueue<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<E>
-
- java.util.concurrent.PriorityBlockingQueue<E>
-
- es.bsc.dataclay.logic.notificationmgr.NotificationManagerPriorityQueue<E>
-
- Type Parameters:
E
- type of element
- All Implemented Interfaces:
Serializable
,Iterable<E>
,Collection<E>
,BlockingQueue<E>
,Queue<E>
public final class NotificationManagerPriorityQueue<E> extends PriorityBlockingQueue<E>
Priority queue with a fixed length that stores in disk pending elements in queue and recovers them every time an object is retrieved.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description NotificationManagerPriorityQueue(int newlimit, NotificationManagerDB newdb)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E msg)
void
fillQueueFromDB()
Fill queue with messages from Database.E
poll()
String
toString()
-
Methods inherited from class java.util.concurrent.PriorityBlockingQueue
clear, comparator, contains, drainTo, drainTo, iterator, offer, offer, peek, poll, put, remainingCapacity, remove, size, spliterator, take, toArray, toArray
-
Methods inherited from class java.util.AbstractQueue
addAll, element, remove
-
Methods inherited from class java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
addAll, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, stream
-
-
-
-
Constructor Detail
-
NotificationManagerPriorityQueue
public NotificationManagerPriorityQueue(int newlimit, NotificationManagerDB newdb)
Constructor- Parameters:
newlimit
- Maximum number of elementsnewdb
- Database used to get/store objects.
-
-
Method Detail
-
add
public boolean add(E msg)
- Specified by:
add
in interfaceBlockingQueue<E>
- Specified by:
add
in interfaceCollection<E>
- Specified by:
add
in interfaceQueue<E>
- Overrides:
add
in classPriorityBlockingQueue<E>
-
toString
public String toString()
- Overrides:
toString
in classPriorityBlockingQueue<E>
-
poll
public E poll()
-
fillQueueFromDB
public void fillQueueFromDB()
Fill queue with messages from Database. This function must be executed after events are processed to avoid REPEATED events.
-
-