public Request add(Request request){
  request.setRequestQueue(this);
synchronized (mCurrentRequests) {
    mCurrentRequests.add(request);
  }
  request.setSequence(getSequenceNumber());
  request.addMarker("add-to-queue");
  if (!request.shouldCache()) {
    mNetworkQueue.add(request);
    return request;
  }
synchronized (mWaitingRequests) {
    String cacheKey=request.getCacheKey();
    if (mWaitingRequests.containsKey(cacheKey)) {
      Queue<Request> stagedRequests=mWaitingRequests.get(cacheKey);
      if (stagedRequests == null) {
        stagedRequests=new LinkedList<Request>();
      }
      stagedRequests.add(request);
      mWaitingRequests.put(cacheKey,stagedRequests);
      if (VolleyLog.DEBUG) {
        VolleyLog.v("Request for cacheKey=%s is in flight, putting on hold.",cacheKey);
      }
    }
 else {
      mWaitingRequests.put(cacheKey,null);
      mCacheQueue.add(request);
    }
    return request;
  }
}

public Request add ( Request request ) { request . setRequestQueue ( this ) ; synchronized ( mCurrentRequests ) { mCurrentRequests . add ( request ) ; } request . setSequence ( getSequenceNumber ( ) ) ; request . addMarker ( "add-to-queue" ) ; if ( ! request . shouldCache ( ) ) { mNetworkQueue . add ( request ) ; return request ; } synchronized ( mWaitingRequests ) { String cacheKey = request . getCacheKey ( ) ; if ( mWaitingRequests . containsKey ( cacheKey ) ) { Queue < Request > stagedRequests = mWaitingRequests . get ( cacheKey ) ; if ( stagedRequests == null ) { stagedRequests = new LinkedList < Request > ( ) ; } stagedRequests . add ( request ) ; mWaitingRequests . put ( cacheKey , stagedRequests ) ; if ( VolleyLog . DEBUG ) { VolleyLog . v ( "Request for cacheKey=%s is in flight, putting on hold." , cacheKey ) ; } } else { mWaitingRequests . put ( cacheKey , null ) ; mCacheQueue . add ( request ) ; } return request ; } }
adds a request to the dispatch queue .
