Package java.util.concurrent.ThreadPoolExecutor

Examples of java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy


          + "' has been explicitly defined. Therefore, a default ThreadPoolTaskScheduler will be created.");
    }
    BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(ThreadPoolTaskScheduler.class);
    builder.addPropertyValue("poolSize", 10);
    builder.addPropertyValue("threadNamePrefix", "task-scheduler-");
    builder.addPropertyValue("rejectedExecutionHandler", new CallerRunsPolicy());
    BeanComponentDefinition schedulerComponent = new BeanComponentDefinition(builder.getBeanDefinition(),
        YarnContextUtils.TASK_SCHEDULER_BEAN_NAME);
    BeanDefinitionReaderUtils.registerBeanDefinition(schedulerComponent, registry);
  }
View Full Code Here


    this.eventBus = checkNotNull(eventBus);
    // direct hand-off used! Proxy pool will use caller thread to execute the task when full!
    final ThreadPoolExecutor target =
        new ThreadPoolExecutor(0, REPOSITORY_THREAD_POOL_SIZE, 60L, TimeUnit.SECONDS,
            new SynchronousQueue<Runnable>(), new NexusThreadFactory("repo", "Repository TPool"),
            new CallerRunsPolicy());

    this.repositoryThreadPool = NexusExecutorService.forCurrentSubject(target);
    eventBus.register(this);
  }
View Full Code Here

    this.eventSubscriberProviders = checkNotNull(eventSubscriberProviders);

    // direct hand-off used! Host pool will use caller thread to execute async inspectors when pool full!
    final ThreadPoolExecutor target =
        new ThreadPoolExecutor(0, HOST_THREAD_POOL_SIZE, 60L, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
            new NexusThreadFactory("esh", "Event Subscriber Host"), new CallerRunsPolicy());
    this.hostThreadPool = NexusExecutorService.forCurrentSubject(target);
    this.asyncBus = new com.google.common.eventbus.AsyncEventBus("esh-async", hostThreadPool);

    eventBus.register(this);
    log.info("Initialized");
View Full Code Here

    @Provides
    @Named(Configuration.ANALYZER_SERVICE)
    public ExecutorService getAnalyzerService() {
        return new ThreadPoolExecutor(1, 2, 1, TimeUnit.MILLISECONDS,
                new ArrayBlockingQueue<Runnable>(1), new CallerRunsPolicy());
    }
View Full Code Here

    @Provides
    @Named(Configuration.REPORT_SERVICE)
    public ExecutorService getReportService() {
        return new ThreadPoolExecutor(1, 2, 1, TimeUnit.MILLISECONDS,
                new ArrayBlockingQueue<Runnable>(1), new CallerRunsPolicy());
    }
View Full Code Here

  public RejectedExecutionHandler getRejectedExecutionHandler() {
    if (rejectedExecutionHandler.equals("AbortPolicy")) {
      return new AbortPolicy();
    } else if (rejectedExecutionHandler.equals("CallerRunsPolicy")) {
      return new CallerRunsPolicy();
    } else if (rejectedExecutionHandler.equals("DiscardOldestPolicy")) {
      return new DiscardOldestPolicy();
    } else {// default "DiscardPolicy"
      return new DiscardPolicy();
    }
View Full Code Here

TOP

Related Classes of java.util.concurrent.ThreadPoolExecutor.CallerRunsPolicy

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.