Java 8 ThreadPoolExecutor.CallerRunsPolicy - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ThreadPoolExecutor.CallerRunsPolicy class.

This code example shows how to use the following methods:
    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);
  } 
 
  @Override 
  public ExecutorService getRepositoryThreadPool(Repository repository) {
    return repositoryThreadPool;
  } 
 
  @Subscribe 
  public void on(final NexusStoppedEvent e) {
    eventBus.unregister(this);
    terminatePool(repositoryThreadPool);
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
 
    @Provides 
    @Named(Configuration.ANALYZER_SERVICE) 
    public ExecutorService getAnalyzerService() { 
        return new ThreadPoolExecutor(1, 2, 1, TimeUnit.MILLISECONDS, 
                new ArrayBlockingQueue<Runnable>(1), new CallerRunsPolicy()); 
    } 
 
    @Provides 
    @Named(Configuration.REPORT_SERVICE) 
    public ExecutorService getReportService() { 
        return new ThreadPoolExecutor(1, 2, 1, TimeUnit.MILLISECONDS, 
                new ArrayBlockingQueue<Runnable>(1), new CallerRunsPolicy()); 
    } 
 
    @Provides 
    public Log getLog() { 
        return log; 
    } 
} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
					40, TimeUnit.SECONDS,
					new java.util.concurrent.LinkedBlockingQueue<Runnable>(
							ApplicationContext.getApplicationContext() 
									.getIntProperty( 
											"component.asynccall.block.size", 
											200) / 2), new CallerRunsPolicy());
		} else { 
			String timeUnit = proMap.getString("timeUnit", "TimeUnit.SECONDS");
			TimeUnit timeUnit_ = TimeUtil.getTimeUnitByName(timeUnit, TimeUnit.SECONDS);
 
			callexecutor = new java.util.concurrent.ThreadPoolExecutor(proMap
					.getInt("corePoolSize", 5), proMap.getInt(
					"maximumPoolSize", 20), proMap.getInt("keepAliveTime", 40),
					timeUnit_,
					new java.util.concurrent.LinkedBlockingQueue<Runnable>(
							ApplicationContext.getApplicationContext() 
									.getIntProperty( 
											"component.asynccall.block.size", 
											200) / 2), new CallerRunsPolicy());
		} 
4
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 ThreadPoolExecutor.CallerRunsPolicy Methods: