/** * Creates and configures a new instance. * * @param dataDirectory root directory where persistent messages are stored * @param useLibAio true to use libaio, false to use NIO. * @param injector Google Guice injector. Used to inject dependency members into commands if needed. * @param queueConfigs vararg of QueueConfig> instances. */ public Async(String dataDirectory, boolean useLibAio, Injector injector, QueueConfig... queueConfigs) { try { this.injector = injector; jmsServer = new EmbeddedJMS(); config = new ConfigurationImpl(); jmsConfig = new JMSConfigurationImpl(); Collections.addAll(queueConfigsList, queueConfigs); configureLocations(dataDirectory); configureAcceptor(); configureConnectionFactory(); configurePaging(); configureQueues(queueConfigs); configureJournal(useLibAio); config.setThreadPoolMaxSize(-1); config.setGracefulShutdownEnabled(true); config.setScheduledThreadPoolMaxSize(10); } catch (AsyncException e) { throw e; } catch (Exception e) { throw new AsyncException("Failed to start EmbeddedJMS", e); } }
/** * Creates and configures a new instance. * * @param dataDirectory root directory where persistent messages are stored * @param useLibAio true to use libaio, false to use NIO. * @param injector Google Guice injector. Used to inject dependency members into commands if needed. * @param queueConfigs vararg of QueueConfig> instances. */ public Async(String dataDirectory, boolean useLibAio, Injector injector, QueueConfig... queueConfigs) { try { this.injector = injector; jmsServer = new EmbeddedJMS(); config = new ConfigurationImpl(); jmsConfig = new JMSConfigurationImpl(); Collections.addAll(queueConfigsList, queueConfigs); configureLocations(dataDirectory); configureAcceptor(); configureConnectionFactory(); configurePaging(); configureQueues(queueConfigs); configureJournal(useLibAio); config.setThreadPoolMaxSize(-1); config.setGracefulShutdownEnabled(true); config.setScheduledThreadPoolMaxSize(10); } catch (AsyncException e) { throw e; } catch (Exception e) { throw new AsyncException("Failed to start EmbeddedJMS", e); } }
config.setScheduledThreadPoolMaxSize(getInteger(e, "scheduled-thread-pool-max-size", config.getScheduledThreadPoolMaxSize(), Validators.GT_ZERO));
configuration.setPersistIDCache(PERSIST_ID_CACHE.resolveModelAttribute(context, model).asBoolean()); configuration.setScheduledThreadPoolMaxSize(SCHEDULED_THREAD_POOL_MAX_SIZE.resolveModelAttribute(context, model).asInt()); configuration.setSecurityEnabled(SECURITY_ENABLED.resolveModelAttribute(context, model).asBoolean()); configuration.setSecurityInvalidationInterval(SECURITY_INVALIDATION_INTERVAL.resolveModelAttribute(context, model).asLong());
configuration.setPersistIDCache(PERSIST_ID_CACHE.resolveModelAttribute(context, model).asBoolean()); configuration.setScheduledThreadPoolMaxSize(SCHEDULED_THREAD_POOL_MAX_SIZE.resolveModelAttribute(context, model).asInt()); configuration.setSecurityEnabled(SECURITY_ENABLED.resolveModelAttribute(context, model).asBoolean()); configuration.setSecurityInvalidationInterval(SECURITY_INVALIDATION_INTERVAL.resolveModelAttribute(context, model).asLong());
conf.setScheduledThreadPoolMaxSize(i); Assert.assertEquals(i, conf.getScheduledThreadPoolMaxSize());
for (int j = 0; j < 100; j++) { int i = RandomUtil.randomInt(); conf.setScheduledThreadPoolMaxSize(i); Assert.assertEquals(i, conf.getScheduledThreadPoolMaxSize());