Package org.apache.thrift.server

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


            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

        }

        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

  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

    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

    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

            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

  }

  public static void simple(Calculator.Processor processor) {
    try {
      TServerTransport serverTransport = new TServerSocket(9090);
      TServer server = new TSimpleServer(new Args(serverTransport).processor(processor));

      // Use this for a multithreaded server
      // TServer server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(processor));

      System.out.println("Starting the simple server...");
      server.serve();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

       *
       * Note: You need not explicitly call open(). The underlying server socket is bound on return
       * from the factory class.
       */
      TServerTransport serverTransport = TSSLTransportFactory.getServerSocket(9091, 0, null, params);
      TServer server = new TSimpleServer(new Args(serverTransport).processor(processor));

      // Use this for a multi threaded server
      // TServer server = new TThreadPoolServer(new TThreadPoolServer.Args(serverTransport).processor(processor));

      System.out.println("Starting the secure server...");
      server.serve();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
View Full Code Here

            TServerSocket socket = new TServerSocket(new TServerSocket.ServerSocketTransportArgs().port(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

TOP

Related Classes of org.apache.thrift.server.TSimpleServer

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.