net.anotheria.util.queue.TimestampedQueueImpl Maven / Gradle / Ivy
package net.anotheria.util.queue;
/**
* Same as normal queue, but with timestamps for last put and get operations.
*
* @author lrosenberg
* Created on 08.11.2004
* @version $Id: $Id
*/
public class TimestampedQueueImpl extends QueueImpl implements ITimestampedQueue {
private long lastPut;
private long lastGet;
/**
* Constructor for TimestampedQueueImpl.
*
* @param size a int.
*/
public TimestampedQueueImpl(int size){
super(size);
}
/** {@inheritDoc} */
@Override public T nextElement() {
lastGet = System.currentTimeMillis();
return super.nextElement();
}
/** {@inheritDoc} */
@Override public void putElement(T o) {
lastPut = System.currentTimeMillis();
super.putElement(o);
}
/** {@inheritDoc} */
@Override public long getLastPutTimestamp(){
return lastPut;
}
/** {@inheritDoc} */
@Override public long getLastGetTimestamp(){
return lastGet;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy