Package org.apache.thrift

Examples of org.apache.thrift.TProcessor


    public void testRejectedExecution()
            throws InterruptedException, TException
    {
        BlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(1);
        ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, queue);
        final TProcessor defaultProcessor = defaultProcessor();
        TProcessor slowProcessor = new TProcessor()
        {
            @Override
            public boolean process(
                    TProtocol in, TProtocol out)
                    throws TException
View Full Code Here


    public void testTaskTimeout()
        throws InterruptedException, TException
    {
        BlockingQueue<Runnable> queue = new ArrayBlockingQueue<>(2);
        ThreadPoolExecutor executor = new ThreadPoolExecutor(1, 1, 60, TimeUnit.SECONDS, queue);
        final TProcessor defaultProcessor = defaultProcessor();
        TProcessor slowProcessor = new TProcessor() {
            @Override
            public boolean process(TProtocol in, TProtocol out) throws TException {
                Uninterruptibles.sleepUninterruptibly(300, TimeUnit.MILLISECONDS);
                return defaultProcessor.process(in, out);
            }
View Full Code Here

    @Test
    public void testThriftService()
            throws Exception
    {
        ThriftScribeService scribeService = new ThriftScribeService();
        TProcessor processor = new scribe.Processor<>(scribeService);

        List<LogEntry> messages = testProcessor(processor);
        assertEquals(scribeService.getMessages(), newArrayList(concat(messages, messages)));
    }
View Full Code Here

    /**
     * Loops on processing a client forever
     */
    public void run() {
      TProcessor processor = null;
      TTransport inputTransport = null;
      TTransport outputTransport = null;
      TProtocol inputProtocol = null;
      TProtocol outputProtocol = null;
      try {
        processor = processorFactory_.getProcessor(client_);
        inputTransport = inputTransportFactory_.getTransport(client_);
        outputTransport = outputTransportFactory_.getTransport(client_);
        inputProtocol = inputProtocolFactory_.getProtocol(inputTransport);
        outputProtocol = outputProtocolFactory_.getProtocol(outputTransport);
        // we check stopped_ first to make sure we're not supposed to be shutting
        // down. this is necessary for graceful shutdown.
        while (!stopped_ && processor.process(inputProtocol, outputProtocol)) {}
      } catch (TTransportException ttx) {
        // Assume the client died and continue silently
      } catch (TException tx) {
        LOGGER.error("Thrift error occurred during processing of message.", tx);
      } catch (Exception x) {
View Full Code Here

   
    /**
     * Loops on processing a client forever
     */
    public void run() {
      TProcessor processor = null;
      TTransport inputTransport = null;
      TTransport outputTransport = null;
      TProtocol inputProtocol = null;
      TProtocol outputProtocol = null;
      try {
        processor = processorFactory_.getProcessor(client_);
        inputTransport = inputTransportFactory_.getTransport(client_);
        outputTransport = outputTransportFactory_.getTransport(client_);
        inputProtocol = inputProtocolFactory_.getProtocol(inputTransport);
        outputProtocol = outputProtocolFactory_.getProtocol(outputTransport);
        while (processor.process(inputProtocol, outputProtocol)) {}
      } catch (TTransportException ttx) {
        // Assume the client died and continue silently
      } catch (TException tx) {
        tx.printStackTrace();
      } catch (Exception x) {
View Full Code Here

      this.saslServer = saslServer;
    }

    @Override
    public TProcessor getProcessor(TTransport trans) {
      TProcessor sqlProcessor = new TCLIService.Processor<Iface>(service);
      return saslServer.wrapNonAssumingProcessor(sqlProcessor);
    }
View Full Code Here

      this.doAsEnabled = conf.getBoolVar(HiveConf.ConfVars.HIVE_SERVER2_ENABLE_DOAS);
    }

    @Override
    public TProcessor getProcessor(TTransport trans) {
      TProcessor baseProcessor =  new TCLIService.Processor<Iface>(service);
      return doAsEnabled ? new TUGIContainingProcessor(baseProcessor, conf) :
            new TSetIpAddressProcessor<Iface>(service);
    }
View Full Code Here

      useSasl = conf.getBoolVar(HiveConf.ConfVars.METASTORE_USE_THRIFT_SASL);

      TServerTransport serverTransport = tcpKeepAlive ?
          new TServerSocketKeepAlive(port) : new TServerSocket(port);

      TProcessor processor;
      TTransportFactory transFactory;
      if (useSasl) {
        // we are in secure mode.
        if (useFramedTransport) {
          throw new HiveMetaException("Framed transport is not supported with SASL enabled.");
View Full Code Here

      TNonblockingServerTransport serverSocket =
        new TNonblockingServerSocket(port);
     
     
      //Processor
      TProcessor  processor =
        new Thrudex.Processor(new ThrudexLuceneHandler(indexRoot));
     
      Options opt = new Options();
      opt.maxWorkerThreads = threadCount;
     
View Full Code Here

      TNonblockingServerTransport serverSocket =
        new TNonblockingServerSocket(port);
     
     
      //Processor
      TProcessor  processor =
        new ThrudocLoggingProcessor(new ThrudocHandler(docRoot));
     
      Options opt = new Options();
      opt.maxWorkerThreads = threadCount;
     
View Full Code Here

TOP

Related Classes of org.apache.thrift.TProcessor

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.