public function fetchResponse(Request $request, $waitForResult = true)
    {
        if ($request->hasResponse()) {
            return $request->getResponse();
        }

        $timer = $this->getFetchTimer($waitForResult);
        $req = new FetchRequest($request->getRequestId(), $waitForResult);

        do {
            try {
                $response = $this->sendFetchRequest($this->getManagerForRequest($request), $req);
                $result = $this->handleFetchResponse($response, $request);

                return $result;
            } catch (TimeoutException $ex) {
                $this->getLogger()->debug($request->getRequestId().': '.$ex->getMessage());
            }
        } while (!$timer->isExpired());

        throw new TimeoutException('Request '.$request->getRequestId().' timed out.');
    }
public function fetchResponse(Request $request, $waitForResult = true)
    {
        if ($request->hasResponse()) {
            return $request->getResponse();
        }

        $timer = $this->getFetchTimer($waitForResult);
        $req = new FetchRequest($request->getRequestId(), $waitForResult);

        do {
            try {
                $response = $this->sendFetchRequest($this->getManagerForRequest($request), $req);
                $result = $this->handleFetchResponse($response, $request);

                return $result;
            } catch (TimeoutException $ex) {
                $this->getLogger()->debug($request->getRequestId().': '.$ex->getMessage());
            }
        } while (!$timer->isExpired());

        throw new TimeoutException('Request '.$request->getRequestId().' timed out.');
    }
public function fetchResponse ( Request $ request , $ waitForResult = true ) { if ( $ request -> hasResponse ( ) ) { return $ request -> getResponse ( ) ; } $ timer = $ this -> getFetchTimer ( $ waitForResult ) ; $ req = new FetchRequest ( $ request -> getRequestId ( ) , $ waitForResult ) ; do { try { $ response = $ this -> sendFetchRequest ( $ this -> getManagerForRequest ( $ request ) , $ req ) ; $ result = $ this -> handleFetchResponse ( $ response , $ request ) ; return $ result ; } catch ( TimeoutException $ ex ) { $ this -> getLogger ( ) -> debug ( $ request -> getRequestId ( ) . ': ' . $ ex -> getMessage ( ) ) ; } } while ( ! $ timer -> isExpired ( ) ) ; throw new TimeoutException ( 'Request ' . $ request -> getRequestId ( ) . ' timed out.' ) ; }
Fetches the response for a request.

Throws a RuntimeException if there is no response (yet) and the timeout
is reached.

@param \AlphaRPC\Client\Request $request
@param boolean                  $waitForResult

@return mixed
@throws \RuntimeException
Fetches the response for a request .