Package org.apache.avro.ipc

Examples of org.apache.avro.ipc.HttpServer


public class AvroHttpProducerTest extends AvroProducerTestSupport {

    @Override
    protected void initializeServer() throws IOException {
        if (server == null) {
            server = new HttpServer(new SpecificResponder(KeyValueProtocol.PROTOCOL, keyValue), avroPort);
            server.start();
        }
       
        if (serverReflection == null) {
            serverReflection = new HttpServer(new ReflectResponder(TestReflection.class, testReflection),
                                              avroPortReflection);
            serverReflection.start();
        }
    }
View Full Code Here


public class TestProtocolHttp extends TestProtocolSpecific {

  @Before
  public void testStartServer() throws Exception {
    server =
      new HttpServer(new SpecificResponder(Simple.class, new TestImpl()), 0);
    client =
      new HttpTransceiver(new URL("http://127.0.0.1:"+server.getPort()+"/"));
    proxy = (Simple)SpecificRequestor.getClient(Simple.class, client);
  }
View Full Code Here

        1000*without/COUNT));
  }

  /** Sends RPCs and returns nanos elapsed. */
  private static long sendRpcs(boolean withPlugin) throws IOException {
    HttpServer server = createServer(withPlugin);
    Transceiver t =
      new HttpTransceiver(new URL("http://127.0.0.1:"+server.getPort()+"/"));
    GenericRequestor requestor = new GenericRequestor(NULL_PROTOCOL, t);

    long now = System.nanoTime();
    for (int i = 0; i < COUNT; ++i) {
      requestor.request("null", null);
    }
    long elapsed = System.nanoTime() - now;
    t.close();
    server.close();
    return elapsed;
  }
View Full Code Here

    Responder r = new IdentityResponder(NULL_PROTOCOL);
    if (withPlugin) {
      r.addRPCPlugin(new StatsPlugin());
    }
    // Start Avro server
    return new HttpServer(r, 0);
  }
View Full Code Here

    Responder r = new SleepyResponder(protocol);
    StatsPlugin p = new StatsPlugin();
    r.addRPCPlugin(p);

    // Start Avro server
    new HttpServer(r, Integer.parseInt(args[0]));

    // Ideally we could use the same Jetty server
    Server httpServer = new Server(Integer.parseInt(args[1]));
    new Context(httpServer, "/").addServlet(
        new ServletHolder(new StatsServlet(p)), "/*");
 
View Full Code Here

  private static BulkData proxy;

  @Before
  public void startServer() throws Exception {
    server =
      new HttpServer(new SpecificResponder(BulkData.class, new BulkDataImpl()),
                     0);
    client =
      new HttpTransceiver(new URL("http://127.0.0.1:"+server.getPort()+"/"));
    proxy = (BulkData)SpecificRequestor.getClient(BulkData.class, client);
  }
View Full Code Here

    boolean bound = false;
   
    while (!bound) {
      // rather than die if port is taken, try to fail over to another port.
      try {
        httpServer = new HttpServer(responder, this.port);
        httpServer.start();
        bound = true;
      } catch (AvroRuntimeException e) {
        if (e.getCause() instanceof BindException) {
          LOG.error("Failed to bind to port: " + this.port);
View Full Code Here

    }
   
    this.out = out;
   
    latch = new CountDownLatch(1);
    server = new HttpServer(new SinkResponder(protocol), uri.getPort());
    server.start();
    out.println("Port: " + server.getPort());
    return 0;
  }
View Full Code Here

    boolean bound = false;
   
    while (!bound) {
      // rather than die if port is taken, try to fail over to another port.
      try {
        httpServer = new HttpServer(responder, this.port);
        httpServer.start();
        bound = true;
      } catch (AvroRuntimeException e) {
        if (e.getCause() instanceof BindException) {
          LOG.error("Failed to bind to port: " + this.port);
View Full Code Here

      printUsageAndExit();
    }
    Log LOG = LogFactory.getLog("AvroServer");
    LOG.info("starting HBase Avro server on port " + Integer.toString(port));
    SpecificResponder r = new SpecificResponder(HBase.class, new HBaseImpl());
    new HttpServer(r, 9090);
    Thread.sleep(1000000);
  }
View Full Code Here

TOP

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

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.