當前位置: 首頁>>代碼示例>>Java>>正文


Java ThreadPoolProfileDefinition類代碼示例

本文整理匯總了Java中org.apache.camel.model.ThreadPoolProfileDefinition的典型用法代碼示例。如果您正苦於以下問題:Java ThreadPoolProfileDefinition類的具體用法?Java ThreadPoolProfileDefinition怎麽用?Java ThreadPoolProfileDefinition使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ThreadPoolProfileDefinition類屬於org.apache.camel.model包,在下文中一共展示了ThreadPoolProfileDefinition類的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: initThreadPoolProfiles

import org.apache.camel.model.ThreadPoolProfileDefinition; //導入依賴的package包/類
protected void initThreadPoolProfiles(T context) throws Exception {
    Set<String> defaultIds = new HashSet<String>();

    // lookup and use custom profiles from the registry
    Map<String, ThreadPoolProfile> profiles = context.getRegistry().findByTypeWithName(ThreadPoolProfile.class);
    if (profiles != null && !profiles.isEmpty()) {
        for (Entry<String, ThreadPoolProfile> entry : profiles.entrySet()) {
            ThreadPoolProfile profile = entry.getValue();
            // do not add if already added, for instance a tracer that is also an InterceptStrategy class
            if (profile.isDefaultProfile()) {
                LOG.info("Using custom default ThreadPoolProfile with id: {} and implementation: {}", entry.getKey(), profile);
                context.getExecutorServiceManager().setDefaultThreadPoolProfile(profile);
                defaultIds.add(entry.getKey());
            } else {
                context.getExecutorServiceManager().registerThreadPoolProfile(profile);
            }
        }
    }

    // use custom profiles defined in the CamelContext
    if (getThreadPoolProfiles() != null && !getThreadPoolProfiles().isEmpty()) {
        for (ThreadPoolProfileDefinition definition : getThreadPoolProfiles()) {
            if (definition.isDefaultProfile()) {
                LOG.info("Using custom default ThreadPoolProfile with id: {} and implementation: {}", definition.getId(), definition);
                context.getExecutorServiceManager().setDefaultThreadPoolProfile(asThreadPoolProfile(context, definition));
                defaultIds.add(definition.getId());
            } else {
                context.getExecutorServiceManager().registerThreadPoolProfile(asThreadPoolProfile(context, definition));
            }
        }
    }

    // validate at most one is defined
    if (defaultIds.size() > 1) {
        throw new IllegalArgumentException("Only exactly one default ThreadPoolProfile is allowed, was " + defaultIds.size() + " ids: " + defaultIds);
    }
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:38,代碼來源:AbstractCamelContextFactoryBean.java

示例2: asThreadPoolProfile

import org.apache.camel.model.ThreadPoolProfileDefinition; //導入依賴的package包/類
/**
 * Creates a {@link ThreadPoolProfile} instance based on the definition.
 *
 * @param context    the camel context
 * @return           the profile
 * @throws Exception is thrown if error creating the profile
 */
private ThreadPoolProfile asThreadPoolProfile(CamelContext context, ThreadPoolProfileDefinition definition) throws Exception {
    ThreadPoolProfile answer = new ThreadPoolProfile();
    answer.setId(definition.getId());
    answer.setDefaultProfile(definition.getDefaultProfile());
    answer.setPoolSize(CamelContextHelper.parseInteger(context, definition.getPoolSize()));
    answer.setMaxPoolSize(CamelContextHelper.parseInteger(context, definition.getMaxPoolSize()));
    answer.setKeepAliveTime(CamelContextHelper.parseLong(context, definition.getKeepAliveTime()));
    answer.setMaxQueueSize(CamelContextHelper.parseInteger(context, definition.getMaxQueueSize()));
    answer.setAllowCoreThreadTimeOut(CamelContextHelper.parseBoolean(context, definition.getAllowCoreThreadTimeOut()));
    answer.setRejectedPolicy(definition.getRejectedPolicy());
    answer.setTimeUnit(definition.getTimeUnit());
    return answer;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:21,代碼來源:AbstractCamelContextFactoryBean.java

示例3: getThreadPoolProfiles

import org.apache.camel.model.ThreadPoolProfileDefinition; //導入依賴的package包/類
public List<ThreadPoolProfileDefinition> getThreadPoolProfiles() {
    return threadPoolProfiles;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:4,代碼來源:CamelContextFactoryBean.java

示例4: setThreadPoolProfiles

import org.apache.camel.model.ThreadPoolProfileDefinition; //導入依賴的package包/類
public void setThreadPoolProfiles(List<ThreadPoolProfileDefinition> threadPoolProfiles) {
    this.threadPoolProfiles = threadPoolProfiles;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:4,代碼來源:CamelContextFactoryBean.java

示例5: getThreadPoolProfiles

import org.apache.camel.model.ThreadPoolProfileDefinition; //導入依賴的package包/類
@Override
public List<ThreadPoolProfileDefinition> getThreadPoolProfiles() {
    return _factoryBean.getThreadPoolProfiles();
}
 
開發者ID:jboss-switchyard,項目名稱:switchyard,代碼行數:5,代碼來源:CamelContextFactoryBeanDelegate.java

示例6: getThreadPoolProfiles

import org.apache.camel.model.ThreadPoolProfileDefinition; //導入依賴的package包/類
public abstract List<ThreadPoolProfileDefinition> getThreadPoolProfiles(); 
開發者ID:HydAu,項目名稱:Camel,代碼行數:2,代碼來源:AbstractCamelContextFactoryBean.java


注:本文中的org.apache.camel.model.ThreadPoolProfileDefinition類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。