add drainAllTo()

This commit is contained in:
zzz
2012-09-02 14:41:21 +00:00
parent c48aca8d5c
commit c965a3dca0
2 changed files with 26 additions and 0 deletions

View File

@ -128,6 +128,9 @@ public class CoDelBlockingQueue<E extends CDQEntry> extends LinkedBlockingQueue<
return codel(rv);
}
/**
* Updates stats and possibly drops while draining.
*/
@Override
public int drainTo(Collection<? super E> c) {
int rv = 0;
@ -139,6 +142,9 @@ public class CoDelBlockingQueue<E extends CDQEntry> extends LinkedBlockingQueue<
return rv;
}
/**
* Updates stats and possibly drops while draining.
*/
@Override
public int drainTo(Collection<? super E> c, int maxElements) {
int rv = 0;
@ -149,6 +155,13 @@ public class CoDelBlockingQueue<E extends CDQEntry> extends LinkedBlockingQueue<
return rv;
}
/**
* Drains all, without updating stats or dropping.
*/
public int drainAllTo(Collection<? super E> c) {
return super.drainTo(c);
}
/////// private below here
/**

View File

@ -139,6 +139,9 @@ public class CoDelPriorityBlockingQueue<E extends CDPQEntry> extends PriorityBlo
return codel(rv);
}
/**
* Updates stats and possibly drops while draining.
*/
@Override
public int drainTo(Collection<? super E> c) {
int rv = 0;
@ -150,6 +153,9 @@ public class CoDelPriorityBlockingQueue<E extends CDPQEntry> extends PriorityBlo
return rv;
}
/**
* Updates stats and possibly drops while draining.
*/
@Override
public int drainTo(Collection<? super E> c, int maxElements) {
int rv = 0;
@ -160,6 +166,13 @@ public class CoDelPriorityBlockingQueue<E extends CDPQEntry> extends PriorityBlo
return rv;
}
/**
* Drains all, without updating stats or dropping.
*/
public int drainAllTo(Collection<? super E> c) {
return super.drainTo(c);
}
/////// private below here
private void timestamp(E o) {