FileDocCategorySizeDatePackage
WaitableQueue.javaAPI DocAndroid 5.1 API2319Thu Mar 12 22:22:56 GMT 2015com.android.volley.mock

WaitableQueue

public class WaitableQueue extends PriorityBlockingQueue

Fields Summary
private final com.android.volley.Request
mStopRequest
private final Semaphore
mStopEvent
Constructors Summary
Methods Summary
public com.android.volley.Requesttake()

        Request<?> item = super.take();
        if (item == mStopRequest) {
            mStopEvent.release();
            return take();
        }
        return item;
    
public voidwaitUntilEmpty(long timeoutMillis)


    // TODO: this isn't really "until empty" it's "until next call to take() after empty"
       
               
        add(mStopRequest);
        if (!mStopEvent.tryAcquire(timeoutMillis, TimeUnit.MILLISECONDS)) {
            throw new TimeoutException();
        }