title: Android - Volley RequestFuture Timeout
body: <p>I'm experiencing a problem when using the <strong>RequestFuture</strong> class of volley.
  Actually it just stops at <code>wait(0)</code>; inside the <code>doGet()</code> Function in the RequestFuture class below and is never getting woken up by <code>onResponse</code> or <code>onErrorResponse</code> as I think it should.</p>
  
  <pre><code>private synchronized T doGet(Long timeoutMs)
          throws InterruptedException, ExecutionException, TimeoutException {
      if (mException != null) {
          throw new ExecutionException(mException);
      }
  
      if (mResultReceived) {
          return mResult;
      }
  
      if (timeoutMs == null) {
          wait(0);
      } else if (timeoutMs &gt; 0) {
          wait(timeoutMs);
      }
  
      if (mException != null) {
          throw new ExecutionException(mException);
      }
  
      if (!mResultReceived) {
          throw new TimeoutException();
      }
  
      return mResult;
  }
  
  @Override
  public boolean isCancelled() {
      if (mRequest == null) {
          return false;
      }
      return mRequest.isCanceled();
  }
  
  @Override
  public synchronized boolean isDone() {
      return mResultReceived || mException != null || isCancelled();
  }
  
  @Override
  public synchronized void onResponse(T response) {
      mResultReceived = true;
      mResult = response;
      notifyAll();
  }
  
  @Override
  public synchronized void onErrorResponse(VolleyError error) {
      mException = error;
      notifyAll();
  }
  </code></pre>
  
  <p>This is the way i try to call all this above.</p>
  
  <pre><code>    RequestFuture&lt;JSONObject&gt; future = RequestFuture.newFuture();
      JsonObjectRequest myReq = new JsonObjectRequest(Request.Method.POST, url, jsonObj, future, future);
      requestQueue.add(myReq);
  
      try {
  
          JSONObject response = future.get();
      } catch (InterruptedException e) {
          // handle the error
      } catch (ExecutionException e) {
          // handle the error
      }
  </code></pre>
  
  <p>I also tried replacing the line </p>
  
  <p><code>requestQueue.add(myReq);</code> </p>
  
  <p>with         </p>
  
  <p><code>future.setRequest(requestQueue.add(myReq));</code></p>
  
  <p>or</p>
  
  <p><code>future.setRequest(myReq);</code></p>
  
  <p>which didn't help either.</p>
  
  <p>I already tried a usual Volley Request which worked just fine using this parameters, so that shouldn't be the cause. 
  I guess the problem is, that the request is never actually executed, which is why the response listeners are never reached. Also tried <code>requestQueue.start()</code>, but didn't change a thing.</p>
  
  <p>I hope I explained my problem well enough,
  Thanks in advance!</p>