Package com.linkedin.r2

Examples of com.linkedin.r2.RemoteInvocationException


      {
        errorResponse = getErrorResponse(response);
      }
      catch (RestLiDecodingException decodingException)
      {
        return new RemoteInvocationException(decodingException);
      }

      Response<?> decodedResponse = null;
      final String header = HeaderUtil.getErrorResponseHeaderValue(response.getHeaders());

      if (header == null)
      {
        try
        {
          decodedResponse = responseDecoder.decodeResponse(response);
        }
        catch (RestLiDecodingException decodingException)
        {
          return new RemoteInvocationException(decodingException);
        }
      }

      return new RestLiResponseException(response, decodedResponse, errorResponse, e);
    }

    if (e instanceof RemoteInvocationException)
    {
      return (RemoteInvocationException) e;
    }

    return new RemoteInvocationException(e);
  }
View Full Code Here


      {
        errorResponse = getErrorResponse(restliException.getResponse());
      }
      catch (RestLiDecodingException decodingException)
      {
        return new RemoteInvocationException(decodingException);
      }

      return new RestLiResponseException(restliException.getResponse(),
                                         restliException.getDecodedResponse(),
                                         errorResponse,
                                         restliException);
    }

    return new RemoteInvocationException(e);
  }
View Full Code Here

        return _responseFuture.get(timeout, unit);
      }
    }
    catch (InterruptedException e)
    {
      throw new RemoteInvocationException(e);
    }
    catch (ExecutionException e)
    {
      // Always need to wrap it, because the cause likely came from a different thread
      // and is not suitable to throw on the current thread.
      RemoteInvocationException exception = ExceptionUtil.wrapThrowable(e.getCause());

      if (_errorHandlingBehavior == ErrorHandlingBehavior.FAIL_ON_ERROR ||
          !(exception instanceof RestLiResponseException))
      {
        throw exception;
View Full Code Here

      public void onResponse(TransportResponse<RestResponse> response)
      {
        if (response.hasError())
        {
          response =
              TransportResponseImpl.error(new RemoteInvocationException("Failed to get response from server for URI "
                                                                            + uri,
                                                                        response.getError()),
                                          response.getWireAttributes());
        }
        else if (!RestStatus.isOK(response.getResponse().getStatus()))
View Full Code Here

        if (!response.hasError())
        {
          if (!RestStatus.isOK(httpResponse.getStatus()))
          {
            newResponse =
                TransportResponseImpl.error(new RemoteInvocationException("Received error "
                                                + httpResponse.getStatus()
                                                + " from server for URI "
                                                + uri),
                                            response.getWireAttributes());
          }
          else
          {
            newResponse = TransportResponseImpl.success(new RpcResponseBuilder()
                    .setEntity(httpResponse.getEntity())
                    .build(), response.getWireAttributes());
          }
        }
        else
        {
          newResponse =
              TransportResponseImpl.error(new RemoteInvocationException("Failed to get response from server for URI "
                                                                            + uri,
                                                                        response.getError()),
                                          response.getWireAttributes());
        }
View Full Code Here

{
  @Test
  public void testFindOriginalThrowable()
  {
    ConnectException connectException = new ConnectException("Foo");
    RemoteInvocationException e = new RemoteInvocationException("Failed to get connect to a server", connectException);
    Throwable throwable = LoadBalancerUtil.findOriginalThrowable(e);

    Assert.assertEquals(throwable, connectException);

    //we only go as far as 100 level deep for finding exception
    Exception npe = new NullPointerException();
    Exception temp = npe;
    for (int i = 0; i < 100; i++)
    {
      e = new RemoteInvocationException(temp);
      temp = e;
    }

    throwable = LoadBalancerUtil.findOriginalThrowable(e);
    Assert.assertEquals(throwable, npe);

    //we add the 101th exception then we lost the reference to NullPointerException
    e = new RemoteInvocationException(temp);
    throwable = LoadBalancerUtil.findOriginalThrowable(e);
    Assert.assertFalse(throwable instanceof NullPointerException);
  }
View Full Code Here

    TransportDispatcher dispatcher = new DelegatingTransportDispatcher(new RestLiServer(config,
                                                                                        resourceFactory,
                                                                                        engine));

    final FilterChain fc = FilterChains.empty().addLast(new SimpleLoggingFilter());
    final HttpServer server = new HttpServerFactory(fc).createServer(port,
                                                               HttpServerFactory.DEFAULT_CONTEXT_PATH,
                                                               NUM_THREADS,
                                                               dispatcher,
                                                               enableAsync,
View Full Code Here

  public Object[][] compressorDataProvider()
  {
    return new Object[][]
      {
        { new SnappyCompressor() },
        { new Bzip2Compressor() },
        { new GzipCompressor() },
        { new DeflateCompressor()}
      };
  }
View Full Code Here

  }

  @Test(dataProvider = "contentEncodingGeneratorDataProvider")
  public void testEncodingGeneration(EncodingType[] encoding, String acceptEncoding)
  {
    ClientCompressionFilter cf = new ClientCompressionFilter(EncodingType.IDENTITY,
                                                             encoding,
                                                             Arrays.asList(new String[]{"*"}));
    Assert.assertEquals(cf.buildAcceptEncodingHeader(), acceptEncoding);
  }
View Full Code Here

    return new Object[][]
      {
        { new SnappyCompressor() },
        { new Bzip2Compressor() },
        { new GzipCompressor() },
        { new DeflateCompressor()}
      };
  }
View Full Code Here

TOP

Related Classes of com.linkedin.r2.RemoteInvocationException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.