Examples of TSimpleServer


Examples of com.facebook.thrift.server.example.TSimpleServer

    TProcessor processor = new LoadTest.Processor(handler);
    TServerTransport transport = new TServerSocket(parser.getListenPort());
    TTransportFactory tfactory = new TFramedTransport.Factory();
    TProtocolFactory pfactory = new TBinaryProtocol.Factory();

    TServer server = new TSimpleServer(processor, transport, tfactory, pfactory);

    return server;
  }
View Full Code Here

Examples of com.facebook.thrift.server.example.TSimpleServer

  public static void main(String [] args) {
    try {
      CalculatorHandler handler = new CalculatorHandler();
      Calculator.Processor processor = new Calculator.Processor(handler);
      TServerTransport serverTransport = new TServerSocket(9090);
      TServer server = new TSimpleServer(processor, serverTransport);

      // Use this for a multithreaded server
      // server = new TThreadPoolServer(processor, serverTransport);

      System.out.println("Starting the server...");
      server.serve();

    } catch (Exception x) {
      x.printStackTrace();
    }
    System.out.println("done.");
View Full Code Here

Examples of com.facebook.thrift.server.example.TSimpleServer

      return tNonblockingServerSocket;
    }

    private void makeSimple() throws IOException, TTransportException {
      // Simple Server
      serverEngine = new TSimpleServer(pFactory,
                                       makeServerSocket(),
                                       new TTransportFactory(),
                                       tProtocolFactory);
    }
View Full Code Here

Examples of com.facebook.thrift.server.example.TSimpleServer

      }

      TServer serverEngine;

      // Simple Server
      serverEngine = new TSimpleServer(new TProcessorFactory(testProcessor),
                                       tServerSocket,
                                       new TTransportFactory(),
                                       tProtocolFactory);

      // ThreadPool Server
View Full Code Here

Examples of org.apache.thrift.server.TSimpleServer

  throws Exception {
    serverThread = new Thread() {
      public void run() {
        try {
          TServerTransport serverTransport = TSSLTransportFactory.getServerSocket(PORT);
          server = new TSimpleServer(new Args(serverTransport).processor(processor));
          server.serve();
        } catch (TTransportException e) {
          e.printStackTrace();
          assert false;
        }
View Full Code Here

Examples of org.apache.thrift.server.TSimpleServer

            TServerSocket socket = new TServerSocket(PORT);

            TTransportFactory factory = new TSaslServerTransport.Factory(
              WRAPPED_MECHANISM, SERVICE, HOST, WRAPPED_PROPS,
              new TestSaslCallbackHandler(PASSWORD));
            server = new TSimpleServer(new Args(socket).processor(processor).transportFactory(factory).protocolFactory(protoFactory));

            // Run it
            LOGGER.debug("Starting the server on port {}", PORT);
            server.serve();
          } catch (Exception e) {
View Full Code Here

Examples of org.apache.thrift.server.TSimpleServer

        }

        TTransportFactory transportFactory = new TFramedTransport.Factory();
        TProtocolFactory protocolFactory = new TBinaryProtocol.Factory();
        TProcessor processor = new ClientConsole.Processor(consoleImpl);
        mConsoleServer = new TSimpleServer(processor, consoleTransport, transportFactory,
            protocolFactory);

        // TODO: Is this technically a race? The Thread.start() method returns
        // when the thread is switched to RUNNING, but there is an arbitrary
        // amount of time before serve() kicks in. TServer does not have any
View Full Code Here

Examples of org.apache.thrift.server.TSimpleServer

  public static void main(String [] args) {
    try {
      CalculatorHandler handler = new CalculatorHandler();
      Calculator.Processor processor = new Calculator.Processor(handler);
      TServerTransport serverTransport = new TServerSocket(9090);
      TServer server = new TSimpleServer(processor, serverTransport);

      // Use this for a multithreaded server
      // server = new TThreadPoolServer(processor, serverTransport);

      System.out.println("Starting the server...");
      server.serve();

    } catch (Exception x) {
      x.printStackTrace();
    }
    System.out.println("done.");
View Full Code Here

Examples of org.apache.thrift.server.TSimpleServer

    final Args serviceArguments = new Args(transport);
    serviceArguments.processor(processor);
    serviceArguments.protocolFactory(Enum.valueOf(Protocol.class, protocol).getFactory());

    final TServer server = new TSimpleServer(serviceArguments);

    log.info("Provisioned everything; now serving {} requests on {}...", protocol,port);

    try {
      server.serve();
    } finally {
      log.info("Closing down everything.");

      server.stop();
    }
  }
View Full Code Here

Examples of org.apache.thrift.server.TSimpleServer

    serverThread = new Thread() {
      public void run() {
        try {
          TServerTransport serverTransport = TSSLTransportFactory.getServerSocket(PORT);
          final Args args = new Args(serverTransport).processor(processor);
          server = new TSimpleServer(args);
          server.serve();
        } catch (TTransportException e) {
          e.printStackTrace();
          assert false;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.