/** * Create and configure a ContextService object to the list of subresources * * @param key * The key for the ContextService resource * @param config * The ContextServiceConsumer to use * @return this */ @SuppressWarnings("unchecked") public T contextService(java.lang.String childKey, ContextServiceConsumer consumer) { ContextService<? extends ContextService> child = new ContextService<>( childKey); if (consumer != null) { consumer.accept(child); } contextService(child); return (T) this; }
public ContextService contextService(java.lang.String key) { return this.contextServices.stream() .filter(e -> e.getKey().equals(key)).findFirst() .orElse(null); } /**
public static EEFraction createDefaultFraction() { EEFraction fraction = new EEFraction(); fraction.specDescriptorPropertyReplacement(false) .contextService(new ContextService(DEFAULT_KEY) .jndiName(CONCURRENCY_CONTEXT_DEFAULT) .useTransactionSetupProvider(false)) .managedThreadFactory(new ManagedThreadFactory(DEFAULT_KEY) .jndiName(CONCURRENCY_FACTORY_DEFAULT) .contextService(DEFAULT_KEY)) .managedExecutorService(new ManagedExecutorService(DEFAULT_KEY) .jndiName(CONCURRENCY_EXECUTOR_DEFAULT) .contextService(DEFAULT_KEY) .hungTaskThreshold(60000L) .coreThreads(5) .maxThreads(25) .keepaliveTime(5000L)) .managedScheduledExecutorService(new ManagedScheduledExecutorService(DEFAULT_KEY) .jndiName(CONCURRENCY_SCHEDULER_DEFAULT) .contextService(DEFAULT_KEY) .hungTaskThreshold(60000L) .coreThreads(5) .keepaliveTime(3000L)); return fraction; }
@SuppressWarnings("unchecked") public EEFraction applyDefaults(DefaultBindingsServiceConsumer config) { specDescriptorPropertyReplacement(false) .contextService(new ContextService(DEFAULT_KEY) .jndiName(CONCURRENCY_CONTEXT_DEFAULT) .useTransactionSetupProvider(false)) // WildFly defaults to true, but that probably needs transactions .managedThreadFactory(new ManagedThreadFactory(DEFAULT_KEY) .jndiName(CONCURRENCY_FACTORY_DEFAULT)
@SuppressWarnings("unchecked") public EEFraction applyDefaults(DefaultBindingsServiceConsumer config) { specDescriptorPropertyReplacement(false) .contextService(new ContextService(DEFAULT_KEY) .jndiName(CONCURRENCY_CONTEXT_DEFAULT) .useTransactionSetupProvider(false)) // WildFly defaults to true, but that probably needs transactions .managedThreadFactory(new ManagedThreadFactory(DEFAULT_KEY) .jndiName(CONCURRENCY_FACTORY_DEFAULT)
/** * Create and configure a ContextService object to the list of subresources * * @param key * The key for the ContextService resource * @param config * The ContextServiceConsumer to use * @return this */ @SuppressWarnings("unchecked") public T contextService(java.lang.String childKey, ContextServiceConsumer consumer) { ContextService<? extends ContextService> child = new ContextService<>( childKey); if (consumer != null) { consumer.accept(child); } contextService(child); return (T) this; }
public ContextService contextService(java.lang.String key) { return this.contextServices.stream() .filter(e -> e.getKey().equals(key)).findFirst() .orElse(null); } /**
public static EEFraction createDefaultFraction() { EEFraction fraction = new EEFraction(); fraction.specDescriptorPropertyReplacement(false) .contextService(new ContextService(DEFAULT_KEY) .jndiName(CONCURRENCY_CONTEXT_DEFAULT) .useTransactionSetupProvider(false)) .managedThreadFactory(new ManagedThreadFactory(DEFAULT_KEY) .jndiName(CONCURRENCY_FACTORY_DEFAULT) .contextService(DEFAULT_KEY)) .managedExecutorService(new ManagedExecutorService(DEFAULT_KEY) .jndiName(CONCURRENCY_EXECUTOR_DEFAULT) .contextService(DEFAULT_KEY) .hungTaskThreshold(60000L) .coreThreads(5) .maxThreads(25) .keepaliveTime(5000L)) .managedScheduledExecutorService(new ManagedScheduledExecutorService(DEFAULT_KEY) .jndiName(CONCURRENCY_SCHEDULER_DEFAULT) .contextService(DEFAULT_KEY) .hungTaskThreshold(60000L) .coreThreads(5) .keepaliveTime(3000L)); fraction.defaultBindingsService((bindings) -> { bindings.contextService("java:jboss/ee/concurrency/context/default"); bindings.managedExecutorService("java:jboss/ee/concurrency/executor/default"); bindings.managedScheduledExecutorService("java:jboss/ee/concurrency/scheduler/default"); bindings.managedThreadFactory("java:jboss/ee/concurrency/factory/default"); }); return fraction; }