Package org.apache.avro.ipc

Examples of org.apache.avro.ipc.AvroRemoteException


    public Object respond(Message message, Object request)
        throws AvroRemoteException {
      try {
        Thread.sleep((Long)((GenericRecord)request).get("millis"));
      } catch (InterruptedException e) {
        throw new AvroRemoteException(e);
      }
      return null;
    }
View Full Code Here


    public Object respond(Message message, Object request)
        throws AvroRemoteException {
      try {
        Thread.sleep((Long)((GenericRecord)request).get("millis"));
      } catch (InterruptedException e) {
        throw new AvroRemoteException(e);
      }
      return null;
    }
View Full Code Here

    public Object respond(Message message, Object request)
        throws AvroRemoteException {
      try {
        Thread.sleep((Long)((GenericRecord)request).get("millis"));
      } catch (InterruptedException e) {
        throw new AvroRemoteException(e);
      }
      return null;
    }
View Full Code Here

  @Test
  public void testError() throws IOException {
    GenericRecord params =
      new GenericData.Record(PROTOCOL.getMessages().get("error").getRequest());
    AvroRemoteException error = null;
    try {
      requestor.request("error", params);
    } catch (AvroRemoteException e) {
      error = e;
    }
    assertNotNull(error);
    assertEquals("an error", ((GenericRecord)error.getValue()).get("message").toString());
  }
View Full Code Here

      if ("error".equals(message.getName())) {
        if (throwUndeclaredError) throw new RuntimeException("foo");
        GenericRecord error =
          new GenericData.Record(PROTOCOL.getType("TestError"));
        error.put("message", new Utf8("an error"));
        throw new AvroRemoteException(error);
      }
     
      throw new AvroRuntimeException("unexpected message: "+message.getName());
    }
View Full Code Here

  @Test
  public void testError() throws IOException {
    GenericRecord params =
      new GenericData.Record(PROTOCOL.getMessages().get("error").getRequest());
    AvroRemoteException error = null;
    try {
      requestor.request("error", params);
    } catch (AvroRemoteException e) {
      error = e;
    }
    assertNotNull(error);
    assertEquals("an error", ((GenericRecord)error.getValue()).get("message").toString());
  }
View Full Code Here

      if ("error".equals(message.getName())) {
        GenericRecord error =
          new GenericData.Record(PROTOCOL.getType("TestError"));
        error.put("message", new Utf8("an error"));
        throw new AvroRemoteException(error);
      }
     
      throw new AvroRuntimeException("unexpected message: "+message.getName());
    }
View Full Code Here

    return new GenericDatumReader<Object>(schema).read(null, in);
  }

  public AvroRemoteException readError(Schema schema, Decoder in)
    throws IOException {
    return new AvroRemoteException(new GenericDatumReader<Object>(schema).read(null,in));
  }
View Full Code Here

  public Exception readError(Schema schema, Decoder in)
    throws IOException {
    Object value = getDatumReader(schema).read(null, in);
    if (value instanceof Exception)
      return (Exception)value;
    return new AvroRemoteException(value);
  }
View Full Code Here

    } catch (Exception e) {
      if (e instanceof RuntimeException)
        throw (RuntimeException)e;
      if (e instanceof IOException)
        throw (IOException)e;
      throw new AvroRemoteException(e);
    }
  }
View Full Code Here

TOP

Related Classes of org.apache.avro.ipc.AvroRemoteException

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.