static Iterable iterateOverBlockingQueue(final LinkedBlockingQueue q) {
return new Iterable() {
public Iterator iterator() {
return new Iterator() {
A x;
public boolean hasNext() ctex {
while (x == null)
x = q.poll(1, TimeUnit.DAYS);
return true;
}
public A next() {
hasNext();
A _x = x;
x = null;
return _x;
}
public void remove() {
}
};
}
};
}