Package org.apache.uima.aae

Examples of org.apache.uima.aae.UimaAsThreadFactory


      // Create a ThreadPoolExecutor with as many threads as needed. The pool has
      // a fixed number of threads that never expire and are never passivated.
      executor = new ThreadPoolExecutor(concurrentConsumerCount, concurrentConsumerCount,
              Long.MAX_VALUE, TimeUnit.NANOSECONDS, workQueue);
      if (controller instanceof PrimitiveAnalysisEngineController) {
        ThreadFactory tf = new UimaAsThreadFactory(threadGroup,
                (PrimitiveAnalysisEngineController) controller);
        executor.setThreadFactory(tf);
      }
      executor.prestartAllCoreThreads();
      controller.changeState(ServiceState.RUNNING);
View Full Code Here


    super.setMessageListener(ml);
    // create task executor with custom thread pool for:
    // 1) GetMeta request processing
    // 2) ReleaseCAS request
    if ( taskExecutor == null ) {
      UimaAsThreadFactory tf = new UimaAsThreadFactory(threadGroup);
      tf.setDaemon(false);
      if ( isFreeCasQueueListener()) {
        tf.setThreadNamePrefix(controller.getComponentName()+" - FreeCASRequest Thread");
      } else if ( isGetMetaListener()  ) {
        tf.setThreadNamePrefix(super.getBeanName()+" - Thread");
      } else if ( getDestination() != null && getMessageSelector() != null ) {
        tf.setThreadNamePrefix(controller.getComponentName() + " Process Thread");
      } else if ( endpoint != null && endpoint.isTempReplyDestination() ) {
        tf.setThreadNamePrefix(super.getBeanName()+" - Thread");
      } else {
        throw new Exception("Unknown Context Detected in setUimaASThreadPoolExecutor()");
      }
      ExecutorService es = Executors.newFixedThreadPool(consumentCount,tf);
      if ( es instanceof ThreadPoolExecutor ) {
          threadPoolExecutor = (ThreadPoolExecutor)es;
          super.setTaskExecutor(es);
      }
    } else {
        UimaAsThreadFactory tf = new UimaAsThreadFactory(threadGroup);
        tf.setDaemon(false);
        if ( isFreeCasQueueListener()) {
          tf.setThreadNamePrefix(controller.getComponentName()+" - FreeCASRequest Thread");
        } else if ( isGetMetaListener()  ) {
          tf.setThreadNamePrefix(super.getBeanName()+" - Thread");
        } else if ( getDestination() != null && getMessageSelector() != null ) {
          tf.setThreadNamePrefix(controller.getComponentName() + " Process Thread");
        } else if ( endpoint != null && endpoint.isTempReplyDestination() ) {
          tf.setThreadNamePrefix(super.getBeanName()+" - Thread");
        } else {
          throw new Exception("Unknown Context Detected in setUimaASThreadPoolExecutor()");
        }
       
    }
View Full Code Here

      }
      latchToCountNumberOfTerminatedThreads = new CountDownLatch(consumers);
      // Create a Custom Thread Factory. Provide it with an instance of
      // PrimitiveController so that every thread can call it to initialize
      // the next available instance of a AE.
      tf = new UimaAsThreadFactory(threadGroup, (PrimitiveAnalysisEngineController) controller, latchToCountNumberOfTerminatedThreads);
      ((UimaAsThreadFactory)tf).setDaemon(true);
      // This ThreadExecutor will use custom thread factory instead of defult one
      ((ThreadPoolTaskExecutor) taskExecutor).setThreadFactory(tf);
      // Initialize the thread pool
      ((ThreadPoolTaskExecutor) taskExecutor).initialize();
View Full Code Here

    super.setMessageListener(ml);
    // create task executor with custom thread pool for:
    // 1) GetMeta request processing
    // 2) ReleaseCAS request
    if ( taskExecutor == null ) {
      UimaAsThreadFactory tf = new UimaAsThreadFactory(threadGroup);
      tf.setDaemon(true);
      if ( isFreeCasQueueListener()) {
        tf.setThreadNamePrefix(controller.getComponentName()+" - FreeCASRequest Thread");
      } else if ( isGetMetaListener()  ) {
        tf.setThreadNamePrefix(super.getBeanName()+" - Thread");
      } else if ( getDestination() != null && getMessageSelector() != null ) {
        tf.setThreadNamePrefix(controller.getComponentName() + " Process Thread");
      } else if ( endpoint != null && endpoint.isTempReplyDestination() ) {
        tf.setThreadNamePrefix(super.getBeanName()+" - Thread");
      } else {
        throw new Exception("Unknown Context Detected in setUimaASThreadPoolExecutor()");
      }
      ExecutorService es = Executors.newFixedThreadPool(consumentCount,tf);
      if ( es instanceof ThreadPoolExecutor ) {
View Full Code Here

        }
      }
      // Create a Custom Thread Factory. Provide it with an instance of
      // PrimitiveController so that every thread can call it to initialize
      // the next available instance of a AE.
      tf = new UimaAsThreadFactory(threadGroup, (PrimitiveAnalysisEngineController) controller);
      ((UimaAsThreadFactory)tf).setDaemon(true);
      // This ThreadExecutor will use custom thread factory instead of defult one
      ((ThreadPoolTaskExecutor) taskExecutor).setThreadFactory(tf);
      // Initialize the thread pool
      ((ThreadPoolTaskExecutor) taskExecutor).initialize();
View Full Code Here

      workQueue = new UimaVmQueue();
      // Create a ThreadPoolExecutor with as many threads as needed. The pool has
      // a fixed number of threads that never expire and are never passivated.
      executor = new ThreadPoolExecutor(concurrentConsumerCount, concurrentConsumerCount,
              Long.MAX_VALUE, TimeUnit.NANOSECONDS, workQueue);
      UimaAsThreadFactory tf = null;
      if (controller instanceof PrimitiveAnalysisEngineController) {
        tf = new UimaAsThreadFactory(threadGroup,
                (PrimitiveAnalysisEngineController) controller);
      } else {
        tf = new UimaAsThreadFactory(threadGroup,null);
      }
      tf.setDaemon(true);
      executor.setThreadFactory(tf);
      executor.prestartAllCoreThreads();
      //controller.changeState(ServiceState.RUNNING);
    }
    return executor;
View Full Code Here

      //  created an unbounded queue. The throttling is controlled by the
      //  semaphore in the UimaBlockingExecutor initialized below
      workQueue = new LinkedBlockingQueue<Runnable>();
      executor = new ThreadPoolExecutor(concurrentThreads, concurrentThreads, Long.MAX_VALUE,
              TimeUnit.NANOSECONDS, workQueue);
      UimaAsThreadFactory tf = new UimaAsThreadFactory(threadGroup);
      tf.setDaemon(true);
      tf.setThreadNamePrefix(threadPrefix);
      executor.setThreadFactory(tf);
     
      executor.prestartAllCoreThreads();
      if ( destination != null ) {
        blockingExecutor = new UimaBlockingExecutor(executor, concurrentThreads, destination);
View Full Code Here

        }
      }
      // Create a Custom Thread Factory. Provide it with an instance of
      // PrimitiveController so that every thread can call it to initialize
      // the next available instance of a AE.
      tf = new UimaAsThreadFactory(threadGroup, (PrimitiveAnalysisEngineController) controller);
      // This ThreadExecutor will use custom thread factory instead of defult one
      ((ThreadPoolTaskExecutor) taskExecutor).setThreadFactory(tf);
      // Initialize the thread pool
      ((ThreadPoolTaskExecutor) taskExecutor).initialize();
      // Make sure all threads are started. This forces each thread to call
View Full Code Here

  
    // create task executor with custom thread pool for:
    // 1) GetMeta request processing
    // 2) ReleaseCAS request
    if ( taskExecutor == null ) {
      UimaAsThreadFactory tf = new UimaAsThreadFactory(threadGroup);
      tf.setDaemon(false);
      if ( isFreeCasQueueListener()) {
        tf.setThreadNamePrefix(controller.getComponentName()+" - FreeCASRequest Thread");
      } else if ( isGetMetaListener()  ) {
        tf.setThreadNamePrefix(super.getBeanName()+" - Thread");
      } else if ( getDestination() != null && getMessageSelector() != null ) {
        tf.setThreadNamePrefix(controller.getComponentName() + " Process Thread");
      } else if ( endpoint != null && endpoint.isTempReplyDestination() ) {
        tf.setThreadNamePrefix(super.getBeanName()+" - Thread");
      } else {
        throw new Exception("Unknown Context Detected in setUimaASThreadPoolExecutor()");
      }
      ExecutorService es = Executors.newFixedThreadPool(consumentCount,tf);
      if ( es instanceof ThreadPoolExecutor ) {
          threadPoolExecutor = (ThreadPoolExecutor)es;
          super.setTaskExecutor(es);
      }
    } else {
        UimaAsThreadFactory tf = new UimaAsThreadFactory(threadGroup);
        tf.setDaemon(true);
        if ( isFreeCasQueueListener()) {
          tf.setThreadNamePrefix(controller.getComponentName()+" - FreeCASRequest Thread");
        } else if ( isGetMetaListener()  ) {
          tf.setThreadNamePrefix(super.getBeanName()+" - Thread");
        } else if ( getDestination() != null && getMessageSelector() != null ) {
          tf.setThreadNamePrefix(controller.getComponentName() + " Process Thread");
        } else if ( endpoint != null && endpoint.isTempReplyDestination() ) {
          tf.setThreadNamePrefix(super.getBeanName()+" - Thread");
        } else {
          throw new Exception("Unknown Context Detected in setUimaASThreadPoolExecutor()");
        }
       
    }
View Full Code Here

      }
      latchToCountNumberOfTerminatedThreads = new CountDownLatch(consumers);
      // Create a Custom Thread Factory. Provide it with an instance of
      // PrimitiveController so that every thread can call it to initialize
      // the next available instance of a AE.
      tf = new UimaAsThreadFactory(threadGroup, (PrimitiveAnalysisEngineController) controller, latchToCountNumberOfTerminatedThreads);
      ((UimaAsThreadFactory)tf).setDaemon(true);
      // This ThreadExecutor will use custom thread factory instead of defult one
      ((ThreadPoolTaskExecutor) taskExecutor).setThreadFactory(tf);
      // Initialize the thread pool
      ((ThreadPoolTaskExecutor) taskExecutor).initialize();
View Full Code Here

TOP

Related Classes of org.apache.uima.aae.UimaAsThreadFactory

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.