Java Code Examples for com.netflix.hystrix.strategy.properties.HystrixProperty

Following code examples demonstrate how to use com.netflix.hystrix.strategy.properties.HystrixProperty from netflix-hystrix. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use com.netflix.hystrix.strategy.properties.HystrixProperty and various code implementation of this class.
Example 1
Project : netflix-hystrix Source File : ConcurrencyStrategyWithExplicitCoreSize.java View Source Code on GitHub

    @Override
    public ThreadPoolExecutor getThreadPool(final HystrixThreadPoolKey threadPoolKey,
                                            final HystrixProperty<Integer> corePoolSize,
                                            final HystrixProperty<Integer> maximumPoolSize,
                                            final HystrixProperty<Integer> keepAliveTime,
                                            final TimeUnit unit,
                                            final BlockingQueue<Runnable> workQueue) {
        int minPoolSize = 10;
        minPoolSize = (minPoolSize < maximumPoolSize.get()) ? minPoolSize : maximumPoolSize.get();

        ThreadPoolExecutor executor = super.getThreadPool(threadPoolKey,
                                                          HystrixProperty.Factory.asProperty(minPoolSize),
                                                          maximumPoolSize,
                                                          keepAliveTime, unit, workQueue);
        executor.allowCoreThreadTimeOut(true);
        executor.prestartAllCoreThreads();
        return executor;
    }