json.put("addressResolverOptions", obj.getAddressResolverOptions().toJson()); json.put("blockedThreadCheckInterval", obj.getBlockedThreadCheckInterval()); if (obj.getBlockedThreadCheckIntervalUnit() != null) { json.put("blockedThreadCheckIntervalUnit", obj.getBlockedThreadCheckIntervalUnit().name());
/** * Copy constructor * * @param other The other {@code VertxOptions} to copy when creating this */ public VertxOptions(VertxOptions other) { this.eventLoopPoolSize = other.getEventLoopPoolSize(); this.workerPoolSize = other.getWorkerPoolSize(); this.blockedThreadCheckInterval = other.getBlockedThreadCheckInterval(); this.maxEventLoopExecuteTime = other.getMaxEventLoopExecuteTime(); this.maxWorkerExecuteTime = other.getMaxWorkerExecuteTime(); this.internalBlockingPoolSize = other.getInternalBlockingPoolSize(); this.clusterManager = other.getClusterManager(); this.haEnabled = other.isHAEnabled(); this.quorumSize = other.getQuorumSize(); this.haGroup = other.getHAGroup(); this.metricsOptions = other.getMetricsOptions() != null ? new MetricsOptions(other.getMetricsOptions()) : null; this.fileSystemOptions = other.getFileSystemOptions() != null ? new FileSystemOptions(other.getFileSystemOptions()) : null; this.warningExceptionTime = other.warningExceptionTime; this.eventBusOptions = new EventBusOptions(other.eventBusOptions); this.addressResolverOptions = other.addressResolverOptions != null ? new AddressResolverOptions() : null; this.maxEventLoopExecuteTimeUnit = other.maxEventLoopExecuteTimeUnit; this.maxWorkerExecuteTimeUnit = other.maxWorkerExecuteTimeUnit; this.warningExceptionTimeUnit = other.warningExceptionTimeUnit; this.blockedThreadCheckIntervalUnit = other.blockedThreadCheckIntervalUnit; }
checker = new BlockedThreadChecker(options.getBlockedThreadCheckInterval(), options.getBlockedThreadCheckIntervalUnit(), options.getWarningExceptionTime(), options.getWarningExceptionTimeUnit()); eventLoopThreadFactory = new VertxThreadFactory("vert.x-eventloop-thread-", checker, false, options.getMaxEventLoopExecuteTime(), options.getMaxEventLoopExecuteTimeUnit()); eventLoopGroup = transport.eventLoopGroup(options.getEventLoopPoolSize(), eventLoopThreadFactory, NETTY_IO_RATIO);
/** * Copy constructor * * @param other The other {@code VertxOptions} to copy when creating this */ public VertxOptions(VertxOptions other) { this.eventLoopPoolSize = other.getEventLoopPoolSize(); this.workerPoolSize = other.getWorkerPoolSize(); this.blockedThreadCheckInterval = other.getBlockedThreadCheckInterval(); this.maxEventLoopExecuteTime = other.getMaxEventLoopExecuteTime(); this.maxWorkerExecuteTime = other.getMaxWorkerExecuteTime(); this.internalBlockingPoolSize = other.getInternalBlockingPoolSize(); this.clusterManager = other.getClusterManager(); this.haEnabled = other.isHAEnabled(); this.quorumSize = other.getQuorumSize(); this.haGroup = other.getHAGroup(); this.metricsOptions = other.getMetricsOptions() != null ? new MetricsOptions(other.getMetricsOptions()) : null; this.fileSystemOptions = other.getFileSystemOptions() != null ? new FileSystemOptions(other.getFileSystemOptions()) : null; this.warningExceptionTime = other.warningExceptionTime; this.eventBusOptions = new EventBusOptions(other.eventBusOptions); this.addressResolverOptions = other.addressResolverOptions != null ? new AddressResolverOptions() : null; this.maxEventLoopExecuteTimeUnit = other.maxEventLoopExecuteTimeUnit; this.maxWorkerExecuteTimeUnit = other.maxWorkerExecuteTimeUnit; this.warningExceptionTimeUnit = other.warningExceptionTimeUnit; this.blockedThreadCheckIntervalUnit = other.blockedThreadCheckIntervalUnit; }
assertEquals(20, options.getInternalBlockingPoolSize()); assertEquals(20, options.getWorkerPoolSize()); assertEquals(1000, options.getBlockedThreadCheckInterval()); assertEquals("localhost", options.getClusterHost()); assertNull(options.getClusterPublicHost()); assertEquals(internalBlockingPoolSize, options.getInternalBlockingPoolSize()); assertEquals(workerPoolSize, options.getWorkerPoolSize()); assertEquals(blockedThreadCheckInterval, options.getBlockedThreadCheckInterval()); assertEquals(clusterHost, options.getClusterHost()); assertEquals(null, options.getClusterManager());
@Test public void testDefaultJsonOptions() { VertxOptions def = new VertxOptions(); VertxOptions json = new VertxOptions(new JsonObject()); assertEquals(def.getEventLoopPoolSize(), json.getEventLoopPoolSize()); assertEquals(def.getWorkerPoolSize(), json.getWorkerPoolSize()); assertEquals(def.isClustered(), json.isClustered()); assertEquals(def.getClusterHost(), json.getClusterHost()); assertEquals(def.getClusterPublicHost(), json.getClusterPublicHost()); assertEquals(def.getClusterPublicPort(), json.getClusterPublicPort()); assertEquals(def.getClusterPingInterval(), json.getClusterPingInterval()); assertEquals(def.getClusterPingReplyInterval(), json.getClusterPingReplyInterval()); assertEquals(def.getBlockedThreadCheckInterval(), json.getBlockedThreadCheckInterval()); assertEquals(def.getMaxEventLoopExecuteTime(), json.getMaxEventLoopExecuteTime()); assertEquals(def.getMaxWorkerExecuteTime(), json.getMaxWorkerExecuteTime()); assertEquals(def.getInternalBlockingPoolSize(), json.getInternalBlockingPoolSize()); assertEquals(def.isHAEnabled(), json.isHAEnabled()); assertEquals(def.getQuorumSize(), json.getQuorumSize()); assertEquals(def.getHAGroup(), json.getHAGroup()); assertEquals(def.getWarningExceptionTime(), json.getWarningExceptionTime()); assertEquals(def.isFileResolverCachingEnabled(), json.isFileResolverCachingEnabled()); assertEquals(def.getMaxEventLoopExecuteTimeUnit(), json.getMaxEventLoopExecuteTimeUnit()); assertEquals(def.getMaxWorkerExecuteTimeUnit(), json.getMaxWorkerExecuteTimeUnit()); assertEquals(def.getWarningExceptionTimeUnit(), json.getWarningExceptionTimeUnit()); assertEquals(def.getBlockedThreadCheckIntervalUnit(), json.getBlockedThreadCheckIntervalUnit()); }
assertEquals(internalBlockingPoolSize, options.getInternalBlockingPoolSize()); assertEquals(workerPoolSize, options.getWorkerPoolSize()); assertEquals(blockedThreadCheckInterval, options.getBlockedThreadCheckInterval()); assertEquals(clusterHost, options.getClusterHost()); assertEquals(clusterPublicHost, options.getClusterPublicHost());
json.put("addressResolverOptions", obj.getAddressResolverOptions().toJson()); json.put("blockedThreadCheckInterval", obj.getBlockedThreadCheckInterval()); if (obj.getBlockedThreadCheckIntervalUnit() != null) { json.put("blockedThreadCheckIntervalUnit", obj.getBlockedThreadCheckIntervalUnit().name());
assertEquals(randomLong, options.getClusterPingReplyInterval()); assertEquals(1000, options.getBlockedThreadCheckInterval()); rand = TestUtils.randomPositiveInt(); assertEquals(options, options.setBlockedThreadCheckInterval(rand)); assertEquals(rand, options.getBlockedThreadCheckInterval()); try { options.setBlockedThreadCheckInterval(0);
checker = new BlockedThreadChecker(options.getBlockedThreadCheckInterval(), options.getBlockedThreadCheckIntervalUnit(), options.getWarningExceptionTime(), options.getWarningExceptionTimeUnit()); eventLoopThreadFactory = new VertxThreadFactory("vert.x-eventloop-thread-", checker, false, options.getMaxEventLoopExecuteTime(), options.getMaxEventLoopExecuteTimeUnit()); eventLoopGroup = transport.eventLoopGroup(options.getEventLoopPoolSize(), eventLoopThreadFactory, NETTY_IO_RATIO);
assertEquals(20, options.getInternalBlockingPoolSize()); assertEquals(20, options.getWorkerPoolSize()); assertEquals(1000, options.getBlockedThreadCheckInterval()); assertEquals("localhost", options.getClusterHost()); assertNull(options.getClusterPublicHost()); assertEquals(internalBlockingPoolSize, options.getInternalBlockingPoolSize()); assertEquals(workerPoolSize, options.getWorkerPoolSize()); assertEquals(blockedThreadCheckInterval, options.getBlockedThreadCheckInterval()); assertEquals(clusterHost, options.getClusterHost()); assertEquals(null, options.getClusterManager());
@Test public void testDefaultJsonOptions() { VertxOptions def = new VertxOptions(); VertxOptions json = new VertxOptions(new JsonObject()); assertEquals(def.getEventLoopPoolSize(), json.getEventLoopPoolSize()); assertEquals(def.getWorkerPoolSize(), json.getWorkerPoolSize()); assertEquals(def.isClustered(), json.isClustered()); assertEquals(def.getClusterHost(), json.getClusterHost()); assertEquals(def.getClusterPublicHost(), json.getClusterPublicHost()); assertEquals(def.getClusterPublicPort(), json.getClusterPublicPort()); assertEquals(def.getClusterPingInterval(), json.getClusterPingInterval()); assertEquals(def.getClusterPingReplyInterval(), json.getClusterPingReplyInterval()); assertEquals(def.getBlockedThreadCheckInterval(), json.getBlockedThreadCheckInterval()); assertEquals(def.getMaxEventLoopExecuteTime(), json.getMaxEventLoopExecuteTime()); assertEquals(def.getMaxWorkerExecuteTime(), json.getMaxWorkerExecuteTime()); assertEquals(def.getInternalBlockingPoolSize(), json.getInternalBlockingPoolSize()); assertEquals(def.isHAEnabled(), json.isHAEnabled()); assertEquals(def.getQuorumSize(), json.getQuorumSize()); assertEquals(def.getHAGroup(), json.getHAGroup()); assertEquals(def.getWarningExceptionTime(), json.getWarningExceptionTime()); assertEquals(def.isFileResolverCachingEnabled(), json.isFileResolverCachingEnabled()); assertEquals(def.getMaxEventLoopExecuteTimeUnit(), json.getMaxEventLoopExecuteTimeUnit()); assertEquals(def.getMaxWorkerExecuteTimeUnit(), json.getMaxWorkerExecuteTimeUnit()); assertEquals(def.getWarningExceptionTimeUnit(), json.getWarningExceptionTimeUnit()); assertEquals(def.getBlockedThreadCheckIntervalUnit(), json.getBlockedThreadCheckIntervalUnit()); }
assertEquals(internalBlockingPoolSize, options.getInternalBlockingPoolSize()); assertEquals(workerPoolSize, options.getWorkerPoolSize()); assertEquals(blockedThreadCheckInterval, options.getBlockedThreadCheckInterval()); assertEquals(clusterHost, options.getClusterHost()); assertEquals(clusterPublicHost, options.getClusterPublicHost());
assertEquals(randomLong, options.getClusterPingReplyInterval()); assertEquals(1000, options.getBlockedThreadCheckInterval()); rand = TestUtils.randomPositiveInt(); assertEquals(options, options.setBlockedThreadCheckInterval(rand)); assertEquals(rand, options.getBlockedThreadCheckInterval()); try { options.setBlockedThreadCheckInterval(0);