1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one or more 3 * contributor license agreements. See the NOTICE file distributed with 4 * this work for additional information regarding copyright ownership. 5 * The ASF licenses this file to You under the Apache License, Version 2.0 6 * (the "License"); you may not use this file except in compliance with 7 * the License. You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 */ 17 module hunt.pool.impl.BaseObjectPoolConfig; 18 19 import hunt.pool.impl.DefaultEvictionPolicy; 20 import hunt.pool.impl.EvictionPolicy; 21 22 23 import hunt.pool.BaseObject; 24 25 import hunt.util.StringBuilder; 26 import hunt.util.Common; 27 import hunt.util.ObjectUtils; 28 29 30 /** 31 * Provides the implementation for the common attributes shared by the 32 * sub-classes. New instances of this class will be created using the defaults 33 * defined by the public constants. 34 * <p> 35 * This class is not thread-safe. 36 * </p> 37 * 38 * @param <T> Type of element pooled. 39 */ 40 abstract class BaseObjectPoolConfig : BaseObject, Cloneable { 41 42 /** 43 * The default value for the {@code lifo} configuration attribute. 44 * @see GenericObjectPool#getLifo() 45 * @see GenericKeyedObjectPool#getLifo() 46 */ 47 enum bool DEFAULT_LIFO = true; 48 49 /** 50 * The default value for the {@code fairness} configuration attribute. 51 * @see GenericObjectPool#getFairness() 52 * @see GenericKeyedObjectPool#getFairness() 53 */ 54 enum bool DEFAULT_FAIRNESS = false; 55 56 /** 57 * The default value for the {@code maxWait} configuration attribute. 58 * @see GenericObjectPool#getMaxWaitMillis() 59 * @see GenericKeyedObjectPool#getMaxWaitMillis() 60 */ 61 enum long DEFAULT_MAX_WAIT_MILLIS = -1L; 62 63 /** 64 * The default value for the {@code minEvictableIdleTimeMillis} 65 * configuration attribute. 66 * @see GenericObjectPool#getMinEvictableIdleTimeMillis() 67 * @see GenericKeyedObjectPool#getMinEvictableIdleTimeMillis() 68 */ 69 enum long DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS = 70 1000L * 60L * 30L; 71 72 /** 73 * The default value for the {@code softMinEvictableIdleTimeMillis} 74 * configuration attribute. 75 * @see GenericObjectPool#getSoftMinEvictableIdleTimeMillis() 76 * @see GenericKeyedObjectPool#getSoftMinEvictableIdleTimeMillis() 77 */ 78 enum long DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS = -1; 79 80 /** 81 * The default value for {@code evictorShutdownTimeoutMillis} configuration 82 * attribute. 83 * @see GenericObjectPool#getEvictorShutdownTimeoutMillis() 84 * @see GenericKeyedObjectPool#getEvictorShutdownTimeoutMillis() 85 */ 86 enum long DEFAULT_EVICTOR_SHUTDOWN_TIMEOUT_MILLIS = 87 10L * 1000L; 88 89 /** 90 * The default value for the {@code numTestsPerEvictionRun} configuration 91 * attribute. 92 * @see GenericObjectPool#getNumTestsPerEvictionRun() 93 * @see GenericKeyedObjectPool#getNumTestsPerEvictionRun() 94 */ 95 enum int DEFAULT_NUM_TESTS_PER_EVICTION_RUN = 3; 96 97 /** 98 * The default value for the {@code testOnCreate} configuration attribute. 99 * @see GenericObjectPool#getTestOnCreate() 100 * @see GenericKeyedObjectPool#getTestOnCreate() 101 * 102 */ 103 enum bool DEFAULT_TEST_ON_CREATE = false; 104 105 /** 106 * The default value for the {@code testOnBorrow} configuration attribute. 107 * @see GenericObjectPool#getTestOnBorrow() 108 * @see GenericKeyedObjectPool#getTestOnBorrow() 109 */ 110 enum bool DEFAULT_TEST_ON_BORROW = false; 111 112 /** 113 * The default value for the {@code testOnReturn} configuration attribute. 114 * @see GenericObjectPool#getTestOnReturn() 115 * @see GenericKeyedObjectPool#getTestOnReturn() 116 */ 117 enum bool DEFAULT_TEST_ON_RETURN = false; 118 119 /** 120 * The default value for the {@code testWhileIdle} configuration attribute. 121 * @see GenericObjectPool#getTestWhileIdle() 122 * @see GenericKeyedObjectPool#getTestWhileIdle() 123 */ 124 enum bool DEFAULT_TEST_WHILE_IDLE = false; 125 126 /** 127 * The default value for the {@code timeBetweenEvictionRunsMillis} 128 * configuration attribute. 129 * @see GenericObjectPool#getTimeBetweenEvictionRunsMillis() 130 * @see GenericKeyedObjectPool#getTimeBetweenEvictionRunsMillis() 131 */ 132 enum long DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS = -1L; 133 134 /** 135 * The default value for the {@code blockWhenExhausted} configuration 136 * attribute. 137 * @see GenericObjectPool#getBlockWhenExhausted() 138 * @see GenericKeyedObjectPool#getBlockWhenExhausted() 139 */ 140 enum bool DEFAULT_BLOCK_WHEN_EXHAUSTED = true; 141 142 /** 143 * The default value for enabling JMX for pools created with a configuration 144 * instance. 145 */ 146 enum bool DEFAULT_JMX_ENABLE = true; 147 148 /** 149 * The default value for the prefix used to name JMX enabled pools created 150 * with a configuration instance. 151 * @see GenericObjectPool#getJmxName() 152 * @see GenericKeyedObjectPool#getJmxName() 153 */ 154 enum string DEFAULT_JMX_NAME_PREFIX = "pool"; 155 156 /** 157 * The default value for the base name to use to name JMX enabled pools 158 * created with a configuration instance. The default is <code>null</code> 159 * which means the pool will provide the base name to use. 160 * @see GenericObjectPool#getJmxName() 161 * @see GenericKeyedObjectPool#getJmxName() 162 */ 163 enum string DEFAULT_JMX_NAME_BASE = null; 164 165 /** 166 * The default value for the {@code evictionPolicyClassName} configuration 167 * attribute. 168 * @see GenericObjectPool#getEvictionPolicyClassName() 169 * @see GenericKeyedObjectPool#getEvictionPolicyClassName() 170 */ 171 enum string DEFAULT_EVICTION_POLICY_CLASS_NAME = typeof(DefaultEvictionPolicy).stringof; 172 173 private bool lifo = DEFAULT_LIFO; 174 175 private bool fairness = DEFAULT_FAIRNESS; 176 177 private long maxWaitMillis = DEFAULT_MAX_WAIT_MILLIS; 178 179 private long minEvictableIdleTimeMillis = 180 DEFAULT_MIN_EVICTABLE_IDLE_TIME_MILLIS; 181 182 private long evictorShutdownTimeoutMillis = 183 DEFAULT_EVICTOR_SHUTDOWN_TIMEOUT_MILLIS; 184 185 private long softMinEvictableIdleTimeMillis = 186 DEFAULT_SOFT_MIN_EVICTABLE_IDLE_TIME_MILLIS; 187 188 private int numTestsPerEvictionRun = 189 DEFAULT_NUM_TESTS_PER_EVICTION_RUN; 190 191 private EvictionPolicy evictionPolicy = null; // Only 2.6.0 applications set this 192 193 private string evictionPolicyClassName = DEFAULT_EVICTION_POLICY_CLASS_NAME; 194 195 private bool testOnCreate = DEFAULT_TEST_ON_CREATE; 196 197 private bool testOnBorrow = DEFAULT_TEST_ON_BORROW; 198 199 private bool testOnReturn = DEFAULT_TEST_ON_RETURN; 200 201 private bool testWhileIdle = DEFAULT_TEST_WHILE_IDLE; 202 203 private long timeBetweenEvictionRunsMillis = 204 DEFAULT_TIME_BETWEEN_EVICTION_RUNS_MILLIS; 205 206 private bool blockWhenExhausted = DEFAULT_BLOCK_WHEN_EXHAUSTED; 207 208 private bool jmxEnabled = DEFAULT_JMX_ENABLE; 209 210 // TODO Consider changing this to a single property for 3.x 211 private string jmxNamePrefix = DEFAULT_JMX_NAME_PREFIX; 212 213 private string jmxNameBase = DEFAULT_JMX_NAME_BASE; 214 215 216 /** 217 * Get the value for the {@code lifo} configuration attribute for pools 218 * created with this configuration instance. 219 * 220 * @return The current setting of {@code lifo} for this configuration 221 * instance 222 * 223 * @see GenericObjectPool#getLifo() 224 * @see GenericKeyedObjectPool#getLifo() 225 */ 226 bool getLifo() { 227 return lifo; 228 } 229 230 /** 231 * Get the value for the {@code fairness} configuration attribute for pools 232 * created with this configuration instance. 233 * 234 * @return The current setting of {@code fairness} for this configuration 235 * instance 236 * 237 * @see GenericObjectPool#getFairness() 238 * @see GenericKeyedObjectPool#getFairness() 239 */ 240 bool getFairness() { 241 return fairness; 242 } 243 244 /** 245 * Set the value for the {@code lifo} configuration attribute for pools 246 * created with this configuration instance. 247 * 248 * @param lifo The new setting of {@code lifo} 249 * for this configuration instance 250 * 251 * @see GenericObjectPool#getLifo() 252 * @see GenericKeyedObjectPool#getLifo() 253 */ 254 void setLifo(bool lifo) { 255 this.lifo = lifo; 256 } 257 258 /** 259 * Set the value for the {@code fairness} configuration attribute for pools 260 * created with this configuration instance. 261 * 262 * @param fairness The new setting of {@code fairness} 263 * for this configuration instance 264 * 265 * @see GenericObjectPool#getFairness() 266 * @see GenericKeyedObjectPool#getFairness() 267 */ 268 void setFairness(bool fairness) { 269 this.fairness = fairness; 270 } 271 272 /** 273 * Get the value for the {@code maxWait} configuration attribute for pools 274 * created with this configuration instance. 275 * 276 * @return The current setting of {@code maxWait} for this 277 * configuration instance 278 * 279 * @see GenericObjectPool#getMaxWaitMillis() 280 * @see GenericKeyedObjectPool#getMaxWaitMillis() 281 */ 282 long getMaxWaitMillis() { 283 return maxWaitMillis; 284 } 285 286 /** 287 * Set the value for the {@code maxWait} configuration attribute for pools 288 * created with this configuration instance. 289 * 290 * @param maxWaitMillis The new setting of {@code maxWaitMillis} 291 * for this configuration instance 292 * 293 * @see GenericObjectPool#getMaxWaitMillis() 294 * @see GenericKeyedObjectPool#getMaxWaitMillis() 295 */ 296 void setMaxWaitMillis(long maxWaitMillis) { 297 this.maxWaitMillis = maxWaitMillis; 298 } 299 300 /** 301 * Get the value for the {@code minEvictableIdleTimeMillis} configuration 302 * attribute for pools created with this configuration instance. 303 * 304 * @return The current setting of {@code minEvictableIdleTimeMillis} for 305 * this configuration instance 306 * 307 * @see GenericObjectPool#getMinEvictableIdleTimeMillis() 308 * @see GenericKeyedObjectPool#getMinEvictableIdleTimeMillis() 309 */ 310 long getMinEvictableIdleTimeMillis() { 311 return minEvictableIdleTimeMillis; 312 } 313 314 /** 315 * Set the value for the {@code minEvictableIdleTimeMillis} configuration 316 * attribute for pools created with this configuration instance. 317 * 318 * @param minEvictableIdleTimeMillis The new setting of 319 * {@code minEvictableIdleTimeMillis} for this configuration instance 320 * 321 * @see GenericObjectPool#getMinEvictableIdleTimeMillis() 322 * @see GenericKeyedObjectPool#getMinEvictableIdleTimeMillis() 323 */ 324 void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) { 325 this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis; 326 } 327 328 /** 329 * Get the value for the {@code softMinEvictableIdleTimeMillis} 330 * configuration attribute for pools created with this configuration 331 * instance. 332 * 333 * @return The current setting of {@code softMinEvictableIdleTimeMillis} 334 * for this configuration instance 335 * 336 * @see GenericObjectPool#getSoftMinEvictableIdleTimeMillis() 337 * @see GenericKeyedObjectPool#getSoftMinEvictableIdleTimeMillis() 338 */ 339 long getSoftMinEvictableIdleTimeMillis() { 340 return softMinEvictableIdleTimeMillis; 341 } 342 343 /** 344 * Set the value for the {@code softMinEvictableIdleTimeMillis} 345 * configuration attribute for pools created with this configuration 346 * instance. 347 * 348 * @param softMinEvictableIdleTimeMillis The new setting of 349 * {@code softMinEvictableIdleTimeMillis} for this configuration 350 * instance 351 * 352 * @see GenericObjectPool#getSoftMinEvictableIdleTimeMillis() 353 * @see GenericKeyedObjectPool#getSoftMinEvictableIdleTimeMillis() 354 */ 355 void setSoftMinEvictableIdleTimeMillis( 356 long softMinEvictableIdleTimeMillis) { 357 this.softMinEvictableIdleTimeMillis = softMinEvictableIdleTimeMillis; 358 } 359 360 /** 361 * Get the value for the {@code numTestsPerEvictionRun} configuration 362 * attribute for pools created with this configuration instance. 363 * 364 * @return The current setting of {@code numTestsPerEvictionRun} for this 365 * configuration instance 366 * 367 * @see GenericObjectPool#getNumTestsPerEvictionRun() 368 * @see GenericKeyedObjectPool#getNumTestsPerEvictionRun() 369 */ 370 int getNumTestsPerEvictionRun() { 371 return numTestsPerEvictionRun; 372 } 373 374 /** 375 * Set the value for the {@code numTestsPerEvictionRun} configuration 376 * attribute for pools created with this configuration instance. 377 * 378 * @param numTestsPerEvictionRun The new setting of 379 * {@code numTestsPerEvictionRun} for this configuration instance 380 * 381 * @see GenericObjectPool#getNumTestsPerEvictionRun() 382 * @see GenericKeyedObjectPool#getNumTestsPerEvictionRun() 383 */ 384 void setNumTestsPerEvictionRun(int numTestsPerEvictionRun) { 385 this.numTestsPerEvictionRun = numTestsPerEvictionRun; 386 } 387 388 /** 389 * Get the value for the {@code evictorShutdownTimeoutMillis} configuration 390 * attribute for pools created with this configuration instance. 391 * 392 * @return The current setting of {@code evictorShutdownTimeoutMillis} for 393 * this configuration instance 394 * 395 * @see GenericObjectPool#getEvictorShutdownTimeoutMillis() 396 * @see GenericKeyedObjectPool#getEvictorShutdownTimeoutMillis() 397 */ 398 long getEvictorShutdownTimeoutMillis() { 399 return evictorShutdownTimeoutMillis; 400 } 401 402 /** 403 * Set the value for the {@code evictorShutdownTimeoutMillis} configuration 404 * attribute for pools created with this configuration instance. 405 * 406 * @param evictorShutdownTimeoutMillis The new setting of 407 * {@code evictorShutdownTimeoutMillis} for this configuration 408 * instance 409 * 410 * @see GenericObjectPool#getEvictorShutdownTimeoutMillis() 411 * @see GenericKeyedObjectPool#getEvictorShutdownTimeoutMillis() 412 */ 413 void setEvictorShutdownTimeoutMillis( 414 long evictorShutdownTimeoutMillis) { 415 this.evictorShutdownTimeoutMillis = evictorShutdownTimeoutMillis; 416 } 417 418 /** 419 * Get the value for the {@code testOnCreate} configuration attribute for 420 * pools created with this configuration instance. 421 * 422 * @return The current setting of {@code testOnCreate} for this 423 * configuration instance 424 * 425 * @see GenericObjectPool#getTestOnCreate() 426 * @see GenericKeyedObjectPool#getTestOnCreate() 427 * 428 */ 429 bool getTestOnCreate() { 430 return testOnCreate; 431 } 432 433 /** 434 * Set the value for the {@code testOnCreate} configuration attribute for 435 * pools created with this configuration instance. 436 * 437 * @param testOnCreate The new setting of {@code testOnCreate} 438 * for this configuration instance 439 * 440 * @see GenericObjectPool#getTestOnCreate() 441 * @see GenericKeyedObjectPool#getTestOnCreate() 442 * 443 */ 444 void setTestOnCreate(bool testOnCreate) { 445 this.testOnCreate = testOnCreate; 446 } 447 448 /** 449 * Get the value for the {@code testOnBorrow} configuration attribute for 450 * pools created with this configuration instance. 451 * 452 * @return The current setting of {@code testOnBorrow} for this 453 * configuration instance 454 * 455 * @see GenericObjectPool#getTestOnBorrow() 456 * @see GenericKeyedObjectPool#getTestOnBorrow() 457 */ 458 bool getTestOnBorrow() { 459 return testOnBorrow; 460 } 461 462 /** 463 * Set the value for the {@code testOnBorrow} configuration attribute for 464 * pools created with this configuration instance. 465 * 466 * @param testOnBorrow The new setting of {@code testOnBorrow} 467 * for this configuration instance 468 * 469 * @see GenericObjectPool#getTestOnBorrow() 470 * @see GenericKeyedObjectPool#getTestOnBorrow() 471 */ 472 void setTestOnBorrow(bool testOnBorrow) { 473 this.testOnBorrow = testOnBorrow; 474 } 475 476 /** 477 * Get the value for the {@code testOnReturn} configuration attribute for 478 * pools created with this configuration instance. 479 * 480 * @return The current setting of {@code testOnReturn} for this 481 * configuration instance 482 * 483 * @see GenericObjectPool#getTestOnReturn() 484 * @see GenericKeyedObjectPool#getTestOnReturn() 485 */ 486 bool getTestOnReturn() { 487 return testOnReturn; 488 } 489 490 /** 491 * Set the value for the {@code testOnReturn} configuration attribute for 492 * pools created with this configuration instance. 493 * 494 * @param testOnReturn The new setting of {@code testOnReturn} 495 * for this configuration instance 496 * 497 * @see GenericObjectPool#getTestOnReturn() 498 * @see GenericKeyedObjectPool#getTestOnReturn() 499 */ 500 void setTestOnReturn(bool testOnReturn) { 501 this.testOnReturn = testOnReturn; 502 } 503 504 /** 505 * Get the value for the {@code testWhileIdle} configuration attribute for 506 * pools created with this configuration instance. 507 * 508 * @return The current setting of {@code testWhileIdle} for this 509 * configuration instance 510 * 511 * @see GenericObjectPool#getTestWhileIdle() 512 * @see GenericKeyedObjectPool#getTestWhileIdle() 513 */ 514 bool getTestWhileIdle() { 515 return testWhileIdle; 516 } 517 518 /** 519 * Set the value for the {@code testWhileIdle} configuration attribute for 520 * pools created with this configuration instance. 521 * 522 * @param testWhileIdle The new setting of {@code testWhileIdle} 523 * for this configuration instance 524 * 525 * @see GenericObjectPool#getTestWhileIdle() 526 * @see GenericKeyedObjectPool#getTestWhileIdle() 527 */ 528 void setTestWhileIdle(bool testWhileIdle) { 529 this.testWhileIdle = testWhileIdle; 530 } 531 532 /** 533 * Get the value for the {@code timeBetweenEvictionRunsMillis} configuration 534 * attribute for pools created with this configuration instance. 535 * 536 * @return The current setting of {@code timeBetweenEvictionRunsMillis} for 537 * this configuration instance 538 * 539 * @see GenericObjectPool#getTimeBetweenEvictionRunsMillis() 540 * @see GenericKeyedObjectPool#getTimeBetweenEvictionRunsMillis() 541 */ 542 long getTimeBetweenEvictionRunsMillis() { 543 return timeBetweenEvictionRunsMillis; 544 } 545 546 /** 547 * Set the value for the {@code timeBetweenEvictionRunsMillis} configuration 548 * attribute for pools created with this configuration instance. 549 * 550 * @param timeBetweenEvictionRunsMillis The new setting of 551 * {@code timeBetweenEvictionRunsMillis} for this configuration 552 * instance 553 * 554 * @see GenericObjectPool#getTimeBetweenEvictionRunsMillis() 555 * @see GenericKeyedObjectPool#getTimeBetweenEvictionRunsMillis() 556 */ 557 void setTimeBetweenEvictionRunsMillis( 558 long timeBetweenEvictionRunsMillis) { 559 this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis; 560 } 561 562 /** 563 * Get the value for the {@code evictionPolicyClass} configuration 564 * attribute for pools created with this configuration instance. 565 * 566 * @return The current setting of {@code evictionPolicyClass} for this 567 * configuration instance 568 * 569 * @see GenericObjectPool#getEvictionPolicy() 570 * @see GenericKeyedObjectPool#getEvictionPolicy() 571 */ 572 EvictionPolicy getEvictionPolicy() { 573 return evictionPolicy; 574 } 575 576 /** 577 * Get the value for the {@code evictionPolicyClassName} configuration 578 * attribute for pools created with this configuration instance. 579 * 580 * @return The current setting of {@code evictionPolicyClassName} for this 581 * configuration instance 582 * 583 * @see GenericObjectPool#getEvictionPolicyClassName() 584 * @see GenericKeyedObjectPool#getEvictionPolicyClassName() 585 */ 586 string getEvictionPolicyClassName() { 587 return evictionPolicyClassName; 588 } 589 590 /** 591 * Set the value for the {@code evictionPolicyClass} configuration 592 * attribute for pools created with this configuration instance. 593 * 594 * @param evictionPolicy The new setting of 595 * {@code evictionPolicyClass} for this configuration instance 596 * 597 * @see GenericObjectPool#getEvictionPolicy() 598 * @see GenericKeyedObjectPool#getEvictionPolicy() 599 */ 600 void setEvictionPolicy(EvictionPolicy evictionPolicy) { 601 this.evictionPolicy = evictionPolicy; 602 } 603 604 /** 605 * Set the value for the {@code evictionPolicyClassName} configuration 606 * attribute for pools created with this configuration instance. 607 * 608 * @param evictionPolicyClassName The new setting of 609 * {@code evictionPolicyClassName} for this configuration instance 610 * 611 * @see GenericObjectPool#getEvictionPolicyClassName() 612 * @see GenericKeyedObjectPool#getEvictionPolicyClassName() 613 */ 614 void setEvictionPolicyClassName(string evictionPolicyClassName) { 615 this.evictionPolicyClassName = evictionPolicyClassName; 616 } 617 618 /** 619 * Get the value for the {@code blockWhenExhausted} configuration attribute 620 * for pools created with this configuration instance. 621 * 622 * @return The current setting of {@code blockWhenExhausted} for this 623 * configuration instance 624 * 625 * @see GenericObjectPool#getBlockWhenExhausted() 626 * @see GenericKeyedObjectPool#getBlockWhenExhausted() 627 */ 628 bool getBlockWhenExhausted() { 629 return blockWhenExhausted; 630 } 631 632 /** 633 * Set the value for the {@code blockWhenExhausted} configuration attribute 634 * for pools created with this configuration instance. 635 * 636 * @param blockWhenExhausted The new setting of {@code blockWhenExhausted} 637 * for this configuration instance 638 * 639 * @see GenericObjectPool#getBlockWhenExhausted() 640 * @see GenericKeyedObjectPool#getBlockWhenExhausted() 641 */ 642 void setBlockWhenExhausted(bool blockWhenExhausted) { 643 this.blockWhenExhausted = blockWhenExhausted; 644 } 645 646 /** 647 * Gets the value of the flag that determines if JMX will be enabled for 648 * pools created with this configuration instance. 649 * 650 * @return The current setting of {@code jmxEnabled} for this configuration 651 * instance 652 */ 653 bool getJmxEnabled() { 654 return jmxEnabled; 655 } 656 657 /** 658 * Sets the value of the flag that determines if JMX will be enabled for 659 * pools created with this configuration instance. 660 * 661 * @param jmxEnabled The new setting of {@code jmxEnabled} 662 * for this configuration instance 663 */ 664 void setJmxEnabled(bool jmxEnabled) { 665 this.jmxEnabled = jmxEnabled; 666 } 667 668 /** 669 * Gets the value of the JMX name base that will be used as part of the 670 * name assigned to JMX enabled pools created with this configuration 671 * instance. A value of <code>null</code> means that the pool will define 672 * the JMX name base. 673 * 674 * @return The current setting of {@code jmxNameBase} for this 675 * configuration instance 676 */ 677 string getJmxNameBase() { 678 return jmxNameBase; 679 } 680 681 /** 682 * Sets the value of the JMX name base that will be used as part of the 683 * name assigned to JMX enabled pools created with this configuration 684 * instance. A value of <code>null</code> means that the pool will define 685 * the JMX name base. 686 * 687 * @param jmxNameBase The new setting of {@code jmxNameBase} 688 * for this configuration instance 689 */ 690 void setJmxNameBase(string jmxNameBase) { 691 this.jmxNameBase = jmxNameBase; 692 } 693 694 /** 695 * Gets the value of the JMX name prefix that will be used as part of the 696 * name assigned to JMX enabled pools created with this configuration 697 * instance. 698 * 699 * @return The current setting of {@code jmxNamePrefix} for this 700 * configuration instance 701 */ 702 string getJmxNamePrefix() { 703 return jmxNamePrefix; 704 } 705 706 /** 707 * Sets the value of the JMX name prefix that will be used as part of the 708 * name assigned to JMX enabled pools created with this configuration 709 * instance. 710 * 711 * @param jmxNamePrefix The new setting of {@code jmxNamePrefix} 712 * for this configuration instance 713 */ 714 void setJmxNamePrefix(string jmxNamePrefix) { 715 this.jmxNamePrefix = jmxNamePrefix; 716 } 717 718 override 719 protected void toStringAppendFields(StringBuilder builder) { 720 builder.append("lifo="); 721 builder.append(lifo); 722 builder.append(", fairness="); 723 builder.append(fairness); 724 builder.append(", maxWaitMillis="); 725 builder.append(maxWaitMillis); 726 builder.append(", minEvictableIdleTimeMillis="); 727 builder.append(minEvictableIdleTimeMillis); 728 builder.append(", softMinEvictableIdleTimeMillis="); 729 builder.append(softMinEvictableIdleTimeMillis); 730 builder.append(", numTestsPerEvictionRun="); 731 builder.append(numTestsPerEvictionRun); 732 builder.append(", evictionPolicyClassName="); 733 builder.append(evictionPolicyClassName); 734 builder.append(", testOnCreate="); 735 builder.append(testOnCreate); 736 builder.append(", testOnBorrow="); 737 builder.append(testOnBorrow); 738 builder.append(", testOnReturn="); 739 builder.append(testOnReturn); 740 builder.append(", testWhileIdle="); 741 builder.append(testWhileIdle); 742 builder.append(", timeBetweenEvictionRunsMillis="); 743 builder.append(timeBetweenEvictionRunsMillis); 744 builder.append(", blockWhenExhausted="); 745 builder.append(blockWhenExhausted); 746 builder.append(", jmxEnabled="); 747 builder.append(jmxEnabled); 748 builder.append(", jmxNamePrefix="); 749 builder.append(jmxNamePrefix); 750 builder.append(", jmxNameBase="); 751 builder.append(jmxNameBase); 752 } 753 754 mixin CloneMemberTemplate!(typeof(this), TopLevel.yes); 755 }