ch.epfl.lpd.ids.utils
Class MyPriorityBlockingQueue<T>

java.lang.Object
  extended by ch.epfl.lpd.ids.utils.MyPriorityBlockingQueue<T>
All Implemented Interfaces:
IBlockingQueue<T>

public class MyPriorityBlockingQueue<T>
extends Object
implements IBlockingQueue<T>

Class implementing the IBlockingQueue class. This class is just a wrapper around a PriorityBlockingQueue

Author:
Sebastien Baehni

Field Summary
protected  PriorityBlockingQueue<T> messages
          The PriorityBlockingQueue that contains all the object of this queue.
 
Constructor Summary
MyPriorityBlockingQueue()
          Creates a new instance of MyPriorityBlockingQueue, i.e., a new PriorityBlockingQueue
 
Method Summary
 T get()
          This method simply calls the take() method of the PriorityBlockingQueue.
 void put(T obj)
          This method simply calls the offer() method of the PriorityBlockingQueue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

messages

protected PriorityBlockingQueue<T> messages
The PriorityBlockingQueue that contains all the object of this queue.

Constructor Detail

MyPriorityBlockingQueue

public MyPriorityBlockingQueue()
Creates a new instance of MyPriorityBlockingQueue, i.e., a new PriorityBlockingQueue

Method Detail

put

public void put(T obj)
This method simply calls the offer() method of the PriorityBlockingQueue

Specified by:
put in interface IBlockingQueue<T>
Parameters:
obj - The object to offer.

get

public T get()
      throws InterruptedException
This method simply calls the take() method of the PriorityBlockingQueue. It returns the last element of the queue.

Specified by:
get in interface IBlockingQueue<T>
Returns:
The last element of the queue that has not already been retrieved.
Throws:
InterruptedException - If an exception occurs while retrieving the last element of this queue.