本文整理匯總了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);
}
}
示例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;
}
示例3: getThreadPoolProfiles
import org.apache.camel.model.ThreadPoolProfileDefinition; //導入依賴的package包/類
public List<ThreadPoolProfileDefinition> getThreadPoolProfiles() {
return threadPoolProfiles;
}
示例4: setThreadPoolProfiles
import org.apache.camel.model.ThreadPoolProfileDefinition; //導入依賴的package包/類
public void setThreadPoolProfiles(List<ThreadPoolProfileDefinition> threadPoolProfiles) {
this.threadPoolProfiles = threadPoolProfiles;
}
示例5: getThreadPoolProfiles
import org.apache.camel.model.ThreadPoolProfileDefinition; //導入依賴的package包/類
@Override
public List<ThreadPoolProfileDefinition> getThreadPoolProfiles() {
return _factoryBean.getThreadPoolProfiles();
}
示例6: getThreadPoolProfiles
import org.apache.camel.model.ThreadPoolProfileDefinition; //導入依賴的package包/類
public abstract List<ThreadPoolProfileDefinition> getThreadPoolProfiles();