001/** 002 * Licensed to the Apache Software Foundation (ASF) under one or more 003 * contributor license agreements. See the NOTICE file distributed with 004 * this work for additional information regarding copyright ownership. 005 * The ASF licenses this file to You under the Apache License, Version 2.0 006 * (the "License"); you may not use this file except in compliance with 007 * the License. You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.apache.camel.model; 018 019import java.util.concurrent.BlockingQueue; 020import java.util.concurrent.Future; 021import java.util.concurrent.ThreadPoolExecutor; 022import java.util.concurrent.TimeUnit; 023 024import javax.xml.bind.annotation.XmlAccessType; 025import javax.xml.bind.annotation.XmlAccessorType; 026import javax.xml.bind.annotation.XmlAttribute; 027 028import org.apache.camel.spi.Metadata; 029 030@XmlAccessorType(XmlAccessType.FIELD) 031public class HystrixConfigurationCommon extends IdentifiedType { 032 033 @XmlAttribute @Metadata(defaultValue = "CamelHystrix") 034 private String groupKey; 035 @XmlAttribute @Metadata(defaultValue = "CamelHystrix") 036 private String threadPoolKey; 037 @XmlAttribute 038 @Metadata(label = "command", defaultValue = "true") 039 private Boolean circuitBreakerEnabled; 040 @XmlAttribute 041 @Metadata(label = "command", defaultValue = "50") 042 private String circuitBreakerErrorThresholdPercentage; 043 @XmlAttribute 044 @Metadata(label = "command", defaultValue = "false") 045 private Boolean circuitBreakerForceClosed; 046 @XmlAttribute 047 @Metadata(label = "command", defaultValue = "false") 048 private Boolean circuitBreakerForceOpen; 049 @XmlAttribute 050 @Metadata(label = "command", defaultValue = "20") 051 private String circuitBreakerRequestVolumeThreshold; 052 @XmlAttribute 053 @Metadata(label = "command", defaultValue = "5000") 054 private String circuitBreakerSleepWindowInMilliseconds; 055 @XmlAttribute 056 @Metadata(label = "command", defaultValue = "20") 057 private String executionIsolationSemaphoreMaxConcurrentRequests; 058 @XmlAttribute 059 @Metadata(label = "command", defaultValue = "THREAD", enums = "THREAD,SEMAPHORE") 060 private String executionIsolationStrategy; 061 @XmlAttribute 062 @Metadata(label = "command", defaultValue = "true") 063 private Boolean executionIsolationThreadInterruptOnTimeout; 064 @XmlAttribute 065 @Metadata(label = "command", defaultValue = "1000") 066 private String executionTimeoutInMilliseconds; 067 @XmlAttribute 068 @Metadata(label = "command", defaultValue = "true") 069 private Boolean executionTimeoutEnabled; 070 @XmlAttribute 071 @Metadata(label = "command", defaultValue = "10") 072 private String fallbackIsolationSemaphoreMaxConcurrentRequests; 073 @XmlAttribute 074 @Metadata(label = "command", defaultValue = "true") 075 private Boolean fallbackEnabled; 076 @XmlAttribute 077 @Metadata(label = "command", defaultValue = "500") 078 private String metricsHealthSnapshotIntervalInMilliseconds; 079 @XmlAttribute 080 @Metadata(label = "command", defaultValue = "10") 081 private String metricsRollingPercentileBucketSize; 082 @XmlAttribute 083 @Metadata(label = "command", defaultValue = "true") 084 private Boolean metricsRollingPercentileEnabled; 085 @XmlAttribute 086 @Metadata(label = "command", defaultValue = "10000") 087 private String metricsRollingPercentileWindowInMilliseconds; 088 @XmlAttribute 089 @Metadata(label = "command", defaultValue = "6") 090 private String metricsRollingPercentileWindowBuckets; 091 @XmlAttribute 092 @Metadata(label = "command", defaultValue = "10000") 093 private String metricsRollingStatisticalWindowInMilliseconds; 094 @XmlAttribute 095 @Metadata(label = "command", defaultValue = "10") 096 private String metricsRollingStatisticalWindowBuckets; 097 @XmlAttribute 098 @Metadata(label = "command", defaultValue = "true") 099 private Boolean requestLogEnabled; 100 101 // thread-pool 102 103 @XmlAttribute 104 @Metadata(label = "threadpool", defaultValue = "10") 105 private String corePoolSize; 106 @XmlAttribute 107 @Metadata(label = "threadpool", defaultValue = "10") 108 private String maximumSize; 109 @XmlAttribute 110 @Metadata(label = "threadpool", defaultValue = "1") 111 private String keepAliveTime; 112 @XmlAttribute 113 @Metadata(label = "threadpool", defaultValue = "-1") 114 private String maxQueueSize; 115 @XmlAttribute 116 @Metadata(label = "threadpool", defaultValue = "5") 117 private String queueSizeRejectionThreshold; 118 @XmlAttribute 119 @Metadata(label = "threadpool", defaultValue = "10000") 120 private String threadPoolRollingNumberStatisticalWindowInMilliseconds; 121 @XmlAttribute 122 @Metadata(label = "threadpool", defaultValue = "10") 123 private String threadPoolRollingNumberStatisticalWindowBuckets; 124 @XmlAttribute 125 @Metadata(label = "threadpool", defaultValue = "false") 126 private Boolean allowMaximumSizeToDivergeFromCoreSize; 127 128 129 // Getter/Setter 130 // ------------------------------------------------------------------------- 131 132 public String getGroupKey() { 133 return groupKey; 134 } 135 136 /** 137 * Sets the group key to use. The default value is CamelHystrix. 138 */ 139 public void setGroupKey(String groupKey) { 140 this.groupKey = groupKey; 141 } 142 143 public String getThreadPoolKey() { 144 return threadPoolKey; 145 } 146 147 /** 148 * Sets the thread pool key to use. Will by default use the same value as groupKey has been configured to use. 149 */ 150 public void setThreadPoolKey(String threadPoolKey) { 151 this.threadPoolKey = threadPoolKey; 152 } 153 154 public Boolean getCircuitBreakerEnabled() { 155 return circuitBreakerEnabled; 156 } 157 158 /** 159 * Whether to use a HystrixCircuitBreaker or not. If false no circuit-breaker logic will be used and all requests permitted. 160 * <p> 161 * This is similar in effect to circuitBreakerForceClosed() except that continues tracking metrics and knowing whether it 162 * should be open/closed, this property results in not even instantiating a circuit-breaker. 163 */ 164 public void setCircuitBreakerEnabled(Boolean circuitBreakerEnabled) { 165 this.circuitBreakerEnabled = circuitBreakerEnabled; 166 } 167 168 public String getCircuitBreakerErrorThresholdPercentage() { 169 return circuitBreakerErrorThresholdPercentage; 170 } 171 172 /** 173 * Error percentage threshold (as whole number such as 50) at which point the circuit breaker will trip open and reject requests. 174 * <p> 175 * It will stay tripped for the duration defined in circuitBreakerSleepWindowInMilliseconds; 176 * <p> 177 * The error percentage this is compared against comes from HystrixCommandMetrics.getHealthCounts(). 178 */ 179 public void setCircuitBreakerErrorThresholdPercentage(Integer circuitBreakerErrorThresholdPercentage) { 180 this.circuitBreakerErrorThresholdPercentage = String.valueOf(circuitBreakerErrorThresholdPercentage); 181 } 182 183 /** 184 * The value can be a property placeholder 185 */ 186 public void setCircuitBreakerErrorThresholdPercentage(String circuitBreakerErrorThresholdPercentage) { 187 this.circuitBreakerErrorThresholdPercentage = circuitBreakerErrorThresholdPercentage; 188 } 189 190 public Boolean getCircuitBreakerForceClosed() { 191 return circuitBreakerForceClosed; 192 } 193 194 /** 195 * If true the HystrixCircuitBreaker#allowRequest() will always return true to allow requests regardless of 196 * the error percentage from HystrixCommandMetrics.getHealthCounts(). 197 * <p> 198 * The circuitBreakerForceOpen() property takes precedence so if it set to true this property does nothing. 199 */ 200 public void setCircuitBreakerForceClosed(Boolean circuitBreakerForceClosed) { 201 this.circuitBreakerForceClosed = circuitBreakerForceClosed; 202 } 203 204 public Boolean getCircuitBreakerForceOpen() { 205 return circuitBreakerForceOpen; 206 } 207 208 /** 209 * If true the HystrixCircuitBreaker.allowRequest() will always return false, causing the circuit to be open (tripped) and reject all requests. 210 * <p> 211 * This property takes precedence over circuitBreakerForceClosed(); 212 */ 213 public void setCircuitBreakerForceOpen(Boolean circuitBreakerForceOpen) { 214 this.circuitBreakerForceOpen = circuitBreakerForceOpen; 215 } 216 217 public String getCircuitBreakerRequestVolumeThreshold() { 218 return circuitBreakerRequestVolumeThreshold; 219 } 220 221 /** 222 * Minimum number of requests in the metricsRollingStatisticalWindowInMilliseconds() that must exist before the HystrixCircuitBreaker will trip. 223 * <p> 224 * If below this number the circuit will not trip regardless of error percentage. 225 */ 226 public void setCircuitBreakerRequestVolumeThreshold(Integer circuitBreakerRequestVolumeThreshold) { 227 this.circuitBreakerRequestVolumeThreshold = String.valueOf(circuitBreakerRequestVolumeThreshold); 228 } 229 230 /** 231 * The value can be a property placeholder 232 */ 233 public void setCircuitBreakerRequestVolumeThreshold(String circuitBreakerRequestVolumeThreshold) { 234 this.circuitBreakerRequestVolumeThreshold = circuitBreakerRequestVolumeThreshold; 235 } 236 237 public String getCircuitBreakerSleepWindowInMilliseconds() { 238 return circuitBreakerSleepWindowInMilliseconds; 239 } 240 241 /** 242 * The time in milliseconds after a HystrixCircuitBreaker trips open that it should wait before trying requests again. 243 */ 244 public void setCircuitBreakerSleepWindowInMilliseconds(Integer circuitBreakerSleepWindowInMilliseconds) { 245 this.circuitBreakerSleepWindowInMilliseconds = String.valueOf(circuitBreakerSleepWindowInMilliseconds); 246 } 247 248 /** 249 * The value can be a property placeholder 250 */ 251 public void setCircuitBreakerSleepWindowInMilliseconds(String circuitBreakerSleepWindowInMilliseconds) { 252 this.circuitBreakerSleepWindowInMilliseconds = circuitBreakerSleepWindowInMilliseconds; 253 } 254 255 public String getExecutionIsolationSemaphoreMaxConcurrentRequests() { 256 return executionIsolationSemaphoreMaxConcurrentRequests; 257 } 258 259 /** 260 * Number of concurrent requests permitted to HystrixCommand.run(). Requests beyond the concurrent limit will be rejected. 261 * <p> 262 * Applicable only when executionIsolationStrategy == SEMAPHORE. 263 */ 264 public void setExecutionIsolationSemaphoreMaxConcurrentRequests(Integer executionIsolationSemaphoreMaxConcurrentRequests) { 265 this.executionIsolationSemaphoreMaxConcurrentRequests = String.valueOf(executionIsolationSemaphoreMaxConcurrentRequests); 266 } 267 268 /** 269 * The value can be a property placeholder 270 */ 271 public void setExecutionIsolationSemaphoreMaxConcurrentRequests(String executionIsolationSemaphoreMaxConcurrentRequests) { 272 this.executionIsolationSemaphoreMaxConcurrentRequests = executionIsolationSemaphoreMaxConcurrentRequests; 273 } 274 275 public String getExecutionIsolationStrategy() { 276 return executionIsolationStrategy; 277 } 278 279 /** 280 * What isolation strategy HystrixCommand.run() will be executed with. 281 * <p> 282 * If THREAD then it will be executed on a separate thread and concurrent requests limited by the number of threads in the thread-pool. 283 * <p> 284 * If SEMAPHORE then it will be executed on the calling thread and concurrent requests limited by the semaphore count. 285 */ 286 public void setExecutionIsolationStrategy(String executionIsolationStrategy) { 287 this.executionIsolationStrategy = executionIsolationStrategy; 288 } 289 290 public Boolean getExecutionIsolationThreadInterruptOnTimeout() { 291 return executionIsolationThreadInterruptOnTimeout; 292 } 293 294 /** 295 * Whether the execution thread should attempt an interrupt (using {@link Future#cancel}) when a thread times out. 296 * <p> 297 * Applicable only when executionIsolationStrategy() == THREAD. 298 */ 299 public void setExecutionIsolationThreadInterruptOnTimeout(Boolean executionIsolationThreadInterruptOnTimeout) { 300 this.executionIsolationThreadInterruptOnTimeout = executionIsolationThreadInterruptOnTimeout; 301 } 302 303 public String getExecutionTimeoutInMilliseconds() { 304 return executionTimeoutInMilliseconds; 305 } 306 307 /** 308 * Time in milliseconds at which point the command will timeout and halt execution. 309 * <p> 310 * If {@link #executionIsolationThreadInterruptOnTimeout} == true and the command is thread-isolated, the executing thread will be interrupted. 311 * If the command is semaphore-isolated and a HystrixObservableCommand, that command will get unsubscribed. 312 */ 313 public void setExecutionTimeoutInMilliseconds(Integer executionTimeoutInMilliseconds) { 314 this.executionTimeoutInMilliseconds = String.valueOf(executionTimeoutInMilliseconds); 315 } 316 317 /** 318 * The value can be a property placeholder 319 */ 320 public void setExecutionTimeoutInMilliseconds(String executionTimeoutInMilliseconds) { 321 this.executionTimeoutInMilliseconds = executionTimeoutInMilliseconds; 322 } 323 324 public Boolean getExecutionTimeoutEnabled() { 325 return executionTimeoutEnabled; 326 } 327 /** 328 * Whether the timeout mechanism is enabled for this command 329 */ 330 public void setExecutionTimeoutEnabled(Boolean executionTimeoutEnabled) { 331 this.executionTimeoutEnabled = executionTimeoutEnabled; 332 } 333 334 public String getFallbackIsolationSemaphoreMaxConcurrentRequests() { 335 return fallbackIsolationSemaphoreMaxConcurrentRequests; 336 } 337 338 /** 339 * Number of concurrent requests permitted to HystrixCommand.getFallback(). 340 * Requests beyond the concurrent limit will fail-fast and not attempt retrieving a fallback. 341 */ 342 public void setFallbackIsolationSemaphoreMaxConcurrentRequests(Integer fallbackIsolationSemaphoreMaxConcurrentRequests) { 343 this.fallbackIsolationSemaphoreMaxConcurrentRequests = String.valueOf(fallbackIsolationSemaphoreMaxConcurrentRequests); 344 } 345 346 /** 347 * The value can be a property placeholder 348 */ 349 public void setFallbackIsolationSemaphoreMaxConcurrentRequests(String fallbackIsolationSemaphoreMaxConcurrentRequests) { 350 this.fallbackIsolationSemaphoreMaxConcurrentRequests = fallbackIsolationSemaphoreMaxConcurrentRequests; 351 } 352 353 public Boolean getFallbackEnabled() { 354 return fallbackEnabled; 355 } 356 357 /** 358 * Whether HystrixCommand.getFallback() should be attempted when failure occurs. 359 */ 360 public void setFallbackEnabled(Boolean fallbackEnabled) { 361 this.fallbackEnabled = fallbackEnabled; 362 } 363 364 public String getMetricsHealthSnapshotIntervalInMilliseconds() { 365 return metricsHealthSnapshotIntervalInMilliseconds; 366 } 367 368 /** 369 * Time in milliseconds to wait between allowing health snapshots to be taken that calculate success and error 370 * percentages and affect HystrixCircuitBreaker.isOpen() status. 371 * <p> 372 * On high-volume circuits the continual calculation of error percentage can become CPU intensive thus this controls how often it is calculated. 373 */ 374 public void setMetricsHealthSnapshotIntervalInMilliseconds(Integer metricsHealthSnapshotIntervalInMilliseconds) { 375 this.metricsHealthSnapshotIntervalInMilliseconds = String.valueOf(metricsHealthSnapshotIntervalInMilliseconds); 376 } 377 378 /** 379 * The value can be a property placeholder 380 */ 381 public void setMetricsHealthSnapshotIntervalInMilliseconds(String metricsHealthSnapshotIntervalInMilliseconds) { 382 this.metricsHealthSnapshotIntervalInMilliseconds = metricsHealthSnapshotIntervalInMilliseconds; 383 } 384 385 public String getMetricsRollingPercentileBucketSize() { 386 return metricsRollingPercentileBucketSize; 387 } 388 389 /** 390 * Maximum number of values stored in each bucket of the rolling percentile. 391 * This is passed into HystrixRollingPercentile inside HystrixCommandMetrics. 392 */ 393 public void setMetricsRollingPercentileBucketSize(Integer metricsRollingPercentileBucketSize) { 394 this.metricsRollingPercentileBucketSize = String.valueOf(metricsRollingPercentileBucketSize); 395 } 396 397 /** 398 * The value can be a property placeholder 399 */ 400 public void setMetricsRollingPercentileBucketSize(String metricsRollingPercentileBucketSize) { 401 this.metricsRollingPercentileBucketSize = metricsRollingPercentileBucketSize; 402 } 403 404 public Boolean getMetricsRollingPercentileEnabled() { 405 return metricsRollingPercentileEnabled; 406 } 407 408 /** 409 * Whether percentile metrics should be captured using HystrixRollingPercentile inside HystrixCommandMetrics. 410 */ 411 public void setMetricsRollingPercentileEnabled(Boolean metricsRollingPercentileEnabled) { 412 this.metricsRollingPercentileEnabled = metricsRollingPercentileEnabled; 413 } 414 415 public String getMetricsRollingPercentileWindowInMilliseconds() { 416 return metricsRollingPercentileWindowInMilliseconds; 417 } 418 419 /** 420 * Duration of percentile rolling window in milliseconds. 421 * This is passed into HystrixRollingPercentile inside HystrixCommandMetrics. 422 */ 423 public void setMetricsRollingPercentileWindowInMilliseconds(Integer metricsRollingPercentileWindowInMilliseconds) { 424 this.metricsRollingPercentileWindowInMilliseconds = String.valueOf(metricsRollingPercentileWindowInMilliseconds); 425 } 426 427 /** 428 * The value can be a property placeholder 429 */ 430 public void setMetricsRollingPercentileWindowInMilliseconds(String metricsRollingPercentileWindowInMilliseconds) { 431 this.metricsRollingPercentileWindowInMilliseconds = metricsRollingPercentileWindowInMilliseconds; 432 } 433 434 public String getMetricsRollingPercentileWindowBuckets() { 435 return metricsRollingPercentileWindowBuckets; 436 } 437 438 /** 439 * Number of buckets the rolling percentile window is broken into. 440 * This is passed into HystrixRollingPercentile inside HystrixCommandMetrics. 441 */ 442 public void setMetricsRollingPercentileWindowBuckets(Integer metricsRollingPercentileWindowBuckets) { 443 this.metricsRollingPercentileWindowBuckets = String.valueOf(metricsRollingPercentileWindowBuckets); 444 } 445 446 /** 447 * The value can be a property placeholder 448 */ 449 public void setMetricsRollingPercentileWindowBuckets(String metricsRollingPercentileWindowBuckets) { 450 this.metricsRollingPercentileWindowBuckets = metricsRollingPercentileWindowBuckets; 451 } 452 453 public String getMetricsRollingStatisticalWindowInMilliseconds() { 454 return metricsRollingStatisticalWindowInMilliseconds; 455 } 456 457 /** 458 * This property sets the duration of the statistical rolling window, in milliseconds. This is how long metrics are kept for the thread pool. 459 * 460 * The window is divided into buckets and “rolls” by those increments. 461 */ 462 public void setMetricsRollingStatisticalWindowInMilliseconds(Integer metricsRollingStatisticalWindowInMilliseconds) { 463 this.metricsRollingStatisticalWindowInMilliseconds = String.valueOf(metricsRollingStatisticalWindowInMilliseconds); 464 } 465 466 /** 467 * The value can be a property placeholder 468 */ 469 public void setMetricsRollingStatisticalWindowInMilliseconds(String metricsRollingStatisticalWindowInMilliseconds) { 470 this.metricsRollingStatisticalWindowInMilliseconds = metricsRollingStatisticalWindowInMilliseconds; 471 } 472 473 public String getMetricsRollingStatisticalWindowBuckets() { 474 return metricsRollingStatisticalWindowBuckets; 475 } 476 477 /** 478 * Number of buckets the rolling statistical window is broken into. 479 * This is passed into HystrixRollingNumber inside HystrixCommandMetrics. 480 */ 481 public void setMetricsRollingStatisticalWindowBuckets(Integer metricsRollingStatisticalWindowBuckets) { 482 this.metricsRollingStatisticalWindowBuckets = String.valueOf(metricsRollingStatisticalWindowBuckets); 483 } 484 485 /** 486 * The value can be a property placeholder 487 */ 488 public void setMetricsRollingStatisticalWindowBuckets(String metricsRollingStatisticalWindowBuckets) { 489 this.metricsRollingStatisticalWindowBuckets = metricsRollingStatisticalWindowBuckets; 490 } 491 492 public Boolean getRequestLogEnabled() { 493 return requestLogEnabled; 494 } 495 496 /** 497 * Whether HystrixCommand execution and events should be logged to HystrixRequestLog. 498 */ 499 public void setRequestLogEnabled(Boolean requestLogEnabled) { 500 this.requestLogEnabled = requestLogEnabled; 501 } 502 503 public String getCorePoolSize() { 504 return corePoolSize; 505 } 506 507 /** 508 * Core thread-pool size that gets passed to {@link java.util.concurrent.ThreadPoolExecutor#setCorePoolSize(int)} 509 */ 510 public void setCorePoolSize(String corePoolSize) { 511 this.corePoolSize = corePoolSize; 512 } 513 514 /** 515 * The value can be a property placeholder 516 */ 517 public void setCorePoolSize(Integer corePoolSize) { 518 this.corePoolSize = String.valueOf(corePoolSize); 519 } 520 521 public String getMaximumSize() { 522 return maximumSize; 523 } 524 525 /** 526 * Maximum thread-pool size that gets passed to {@link ThreadPoolExecutor#setMaximumPoolSize(int)}. 527 * This is the maximum amount of concurrency that can be supported without starting to reject HystrixCommands. 528 * Please note that this setting only takes effect if you also set allowMaximumSizeToDivergeFromCoreSize 529 */ 530 public void setMaximumSize(Integer maximumSize) { 531 this.maximumSize = String.valueOf(maximumSize); 532 } 533 534 /** 535 * The value can be a property placeholder 536 */ 537 public void setMaximumSize(String maximumSize) { 538 this.maximumSize = maximumSize; 539 } 540 541 public String getKeepAliveTime() { 542 return keepAliveTime; 543 } 544 545 /** 546 * Keep-alive time in minutes that gets passed to {@link ThreadPoolExecutor#setKeepAliveTime(long, TimeUnit)} 547 */ 548 public void setKeepAliveTime(Integer keepAliveTime) { 549 this.keepAliveTime = String.valueOf(keepAliveTime); 550 } 551 552 /** 553 * The value can be a property placeholder 554 */ 555 public void setKeepAliveTime(String keepAliveTime) { 556 this.keepAliveTime = keepAliveTime; 557 } 558 559 public String getMaxQueueSize() { 560 return maxQueueSize; 561 } 562 563 /** 564 * Max queue size that gets passed to {@link BlockingQueue} in HystrixConcurrencyStrategy.getBlockingQueue(int) 565 * 566 * This should only affect the instantiation of a threadpool - it is not eliglible to change a queue size on the fly. 567 * For that, use queueSizeRejectionThreshold(). 568 */ 569 public void setMaxQueueSize(Integer maxQueueSize) { 570 this.maxQueueSize = String.valueOf(maxQueueSize); 571 } 572 573 /** 574 * The value can be a property placeholder 575 */ 576 public void setMaxQueueSize(String maxQueueSize) { 577 this.maxQueueSize = maxQueueSize; 578 } 579 580 public String getQueueSizeRejectionThreshold() { 581 return queueSizeRejectionThreshold; 582 } 583 584 /** 585 * Queue size rejection threshold is an artificial "max" size at which rejections will occur even 586 * if {@link #maxQueueSize} has not been reached. This is done because the {@link #maxQueueSize} 587 * of a {@link BlockingQueue} can not be dynamically changed and we want to support dynamically 588 * changing the queue size that affects rejections. 589 * <p> 590 * This is used by HystrixCommand when queuing a thread for execution. 591 */ 592 public void setQueueSizeRejectionThreshold(Integer queueSizeRejectionThreshold) { 593 this.queueSizeRejectionThreshold = String.valueOf(queueSizeRejectionThreshold); 594 } 595 596 /** 597 * The value can be a property placeholder 598 */ 599 public void setQueueSizeRejectionThreshold(String queueSizeRejectionThreshold) { 600 this.queueSizeRejectionThreshold = queueSizeRejectionThreshold; 601 } 602 603 public String getThreadPoolRollingNumberStatisticalWindowInMilliseconds() { 604 return threadPoolRollingNumberStatisticalWindowInMilliseconds; 605 } 606 607 /** 608 * Duration of statistical rolling window in milliseconds. 609 * This is passed into HystrixRollingNumber inside each HystrixThreadPoolMetrics instance. 610 */ 611 public void setThreadPoolRollingNumberStatisticalWindowInMilliseconds(Integer threadPoolRollingNumberStatisticalWindowInMilliseconds) { 612 this.threadPoolRollingNumberStatisticalWindowInMilliseconds = String.valueOf(threadPoolRollingNumberStatisticalWindowInMilliseconds); 613 } 614 615 /** 616 * The value can be a property placeholder 617 */ 618 public void setThreadPoolRollingNumberStatisticalWindowInMilliseconds(String threadPoolRollingNumberStatisticalWindowInMilliseconds) { 619 this.threadPoolRollingNumberStatisticalWindowInMilliseconds = threadPoolRollingNumberStatisticalWindowInMilliseconds; 620 } 621 622 public String getThreadPoolRollingNumberStatisticalWindowBuckets() { 623 return threadPoolRollingNumberStatisticalWindowBuckets; 624 } 625 626 /** 627 * Number of buckets the rolling statistical window is broken into. 628 * This is passed into HystrixRollingNumber inside each HystrixThreadPoolMetrics instance. 629 */ 630 public void setThreadPoolRollingNumberStatisticalWindowBuckets(Integer threadPoolRollingNumberStatisticalWindowBuckets) { 631 this.threadPoolRollingNumberStatisticalWindowBuckets = String.valueOf(threadPoolRollingNumberStatisticalWindowBuckets); 632 } 633 634 /** 635 * The value can be a property placeholder 636 */ 637 public void setThreadPoolRollingNumberStatisticalWindowBuckets(String threadPoolRollingNumberStatisticalWindowBuckets) { 638 this.threadPoolRollingNumberStatisticalWindowBuckets = threadPoolRollingNumberStatisticalWindowBuckets; 639 } 640 641 public Boolean getAllowMaximumSizeToDivergeFromCoreSize() { 642 return allowMaximumSizeToDivergeFromCoreSize; 643 } 644 645 /** 646 * Allows the configuration for maximumSize to take effect. That value can then be equal to, or higher, than coreSize 647 */ 648 public void setAllowMaximumSizeToDivergeFromCoreSize(Boolean allowMaximumSizeToDivergeFromCoreSize) { 649 this.allowMaximumSizeToDivergeFromCoreSize = allowMaximumSizeToDivergeFromCoreSize; 650 } 651}