当前位置: 首页>>代码示例>>Java>>正文


Java ThreadPoolProfile.getPoolSize方法代码示例

本文整理汇总了Java中org.apache.camel.spi.ThreadPoolProfile.getPoolSize方法的典型用法代码示例。如果您正苦于以下问题:Java ThreadPoolProfile.getPoolSize方法的具体用法?Java ThreadPoolProfile.getPoolSize怎么用?Java ThreadPoolProfile.getPoolSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.camel.spi.ThreadPoolProfile的用法示例。


在下文中一共展示了ThreadPoolProfile.getPoolSize方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: newScheduledThreadPool

import org.apache.camel.spi.ThreadPoolProfile; //导入方法依赖的package包/类
@Override
public ScheduledExecutorService newScheduledThreadPool(ThreadPoolProfile profile, ThreadFactory threadFactory) {
    RejectedExecutionHandler rejectedExecutionHandler = profile.getRejectedExecutionHandler();
    if (rejectedExecutionHandler == null) {
        rejectedExecutionHandler = new ThreadPoolExecutor.CallerRunsPolicy();
    }

    ScheduledThreadPoolExecutor answer = new RejectableScheduledThreadPoolExecutor(profile.getPoolSize(), threadFactory, rejectedExecutionHandler);
    answer.setRemoveOnCancelPolicy(true);

    // need to wrap the thread pool in a sized to guard against the problem that the
    // JDK created thread pool has an unbounded queue (see class javadoc), which mean
    // we could potentially keep adding tasks, and run out of memory.
    if (profile.getMaxPoolSize() > 0) {
        return new SizedScheduledExecutorService(answer, profile.getMaxQueueSize());
    } else {
        return answer;
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:20,代码来源:DefaultThreadPoolFactory.java

示例2: newScheduledThreadPool

import org.apache.camel.spi.ThreadPoolProfile; //导入方法依赖的package包/类
@Override
public ScheduledExecutorService newScheduledThreadPool(ThreadPoolProfile profile, ThreadFactory threadFactory) {
    RejectedExecutionHandler rejectedExecutionHandler = profile.getRejectedExecutionHandler();
    if (rejectedExecutionHandler == null) {
        rejectedExecutionHandler = new ThreadPoolExecutor.CallerRunsPolicy();
    }

    ScheduledThreadPoolExecutor answer = new RejectableScheduledThreadPoolExecutor(
        profile.getPoolSize(), managedThreadFactory, rejectedExecutionHandler);

    if (profile.getMaxPoolSize() > 0) {
        return new SizedScheduledExecutorService(answer, profile.getMaxQueueSize());
    } else {
        return answer;
    }
}
 
开发者ID:wildfly-extras,项目名称:wildfly-camel,代码行数:17,代码来源:WildFlyCamelThreadPoolFactory.java

示例3: lookupScheduled

import org.apache.camel.spi.ThreadPoolProfile; //导入方法依赖的package包/类
public ScheduledExecutorService lookupScheduled(Object source, String name, String executorServiceRef) {
    ScheduledExecutorService answer = camelContext.getRegistry().lookupByNameAndType(executorServiceRef, ScheduledExecutorService.class);
    if (answer == null) {
        ThreadPoolProfile profile = getThreadPoolProfile(executorServiceRef);
        if (profile != null) {
            Integer poolSize = profile.getPoolSize();
            if (poolSize == null) {
                poolSize = getDefaultThreadPoolProfile().getPoolSize();
            }
            answer = newScheduledThreadPool(source, name, poolSize);
        }
    }
    return answer;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:15,代码来源:DefaultExecutorServiceStrategy.java


注:本文中的org.apache.camel.spi.ThreadPoolProfile.getPoolSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。