001/* 002 * Copyright 2011-2019 Ping Identity Corporation 003 * All Rights Reserved. 004 */ 005/* 006 * Copyright (C) 2015-2019 Ping Identity Corporation 007 * 008 * This program is free software; you can redistribute it and/or modify 009 * it under the terms of the GNU General Public License (GPLv2 only) 010 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only) 011 * as published by the Free Software Foundation. 012 * 013 * This program is distributed in the hope that it will be useful, 014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 016 * GNU General Public License for more details. 017 * 018 * You should have received a copy of the GNU General Public License 019 * along with this program; if not, see <http://www.gnu.org/licenses>. 020 */ 021package com.unboundid.ldap.sdk.unboundidds.monitors; 022 023 024 025import java.util.Collections; 026import java.util.LinkedHashMap; 027import java.util.Map; 028 029import com.unboundid.ldap.sdk.Entry; 030import com.unboundid.util.NotMutable; 031import com.unboundid.util.StaticUtils; 032import com.unboundid.util.ThreadSafety; 033import com.unboundid.util.ThreadSafetyLevel; 034 035import static com.unboundid.ldap.sdk.unboundidds.monitors.MonitorMessages.*; 036 037 038 039/** 040 * This class defines a monitor entry that provides information about the sate 041 * of a FIFO entry cache in the Directory Server. 042 * <BR> 043 * <BLOCKQUOTE> 044 * <B>NOTE:</B> This class, and other classes within the 045 * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only 046 * supported for use against Ping Identity, UnboundID, and 047 * Nokia/Alcatel-Lucent 8661 server products. These classes provide support 048 * for proprietary functionality or for external specifications that are not 049 * considered stable or mature enough to be guaranteed to work in an 050 * interoperable way with other types of LDAP servers. 051 * </BLOCKQUOTE> 052 * <BR> 053 * The information that may be available about the entry cache includes: 054 * <UL> 055 * <LI>The name assigned to the cache.</LI> 056 * <LI>The number of attempts (successful and total) and the hit ratio when 057 * trying to retrieve an entry from the cache.</LI> 058 * <LI>The maximum allowed size of the entry cache in entries and bytes.</LI> 059 * <LI>The number of entries currently held in the cache.</LI> 060 * <LI>The number of entries added to or updated in the cache.</LI> 061 * <LI>The number of times an entry was not added to the cache because it was 062 * already present.</LI> 063 * <LI>The number of times an entry was not added to the cache because it did 064 * not match filter criteria required for inclusion.</LI> 065 * <LI>The number of times an entry was not added to the cache because it was 066 * too small to be included.</LI> 067 * <LI>The number of times an entry was evicted because of memory pressure or 068 * to make room for new entries.</LI> 069 * <LI>Information about the current memory consumption of the cache and 070 * whether the cache is currently full.</LI> 071 * </UL> 072 * The server will automatically present one monitor entry for every FIFO entry 073 * cache defined in the server. It is possible to have multiple caches enabled 074 * if desired (e.g., one specifically targeting large static groups, and another 075 * small cache to help improve write-after-read performance). FIFO entry cache 076 * monitor entries can be retrieved using the 077 * {@link MonitorManager#getFIFOEntryCacheMonitorEntries} method. These monitor 078 * entries provide specific methods for accessing information about the FIFO 079 * entry cache. Alternately, this information may be accessed using the generic 080 * API. See the {@link MonitorManager} class documentation for an example that 081 * demonstrates the use of the generic API for accessing monitor data. 082 */ 083@NotMutable() 084@ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) 085public final class FIFOEntryCacheMonitorEntry 086 extends MonitorEntry 087{ 088 /** 089 * The structural object class used in entry cache monitor entries. 090 */ 091 static final String FIFO_ENTRY_CACHE_MONITOR_OC = 092 "ds-fifo-entry-cache-monitor-entry"; 093 094 095 096 /** 097 * The name of the attribute that holds the name of the associated FIFO entry 098 * cache. 099 */ 100 private static final String ATTR_CACHE_NAME = "cacheName"; 101 102 103 104 /** 105 * The name of the attribute that holds the number of cache hits. 106 */ 107 private static final String ATTR_ENTRY_CACHE_HITS = "entryCacheHits"; 108 109 110 111 /** 112 * The name of the attribute that holds the number of cache tries. 113 */ 114 private static final String ATTR_ENTRY_CACHE_TRIES = "entryCacheTries"; 115 116 117 118 /** 119 * The name of the attribute that holds the cache hit ratio. 120 */ 121 private static final String ATTR_ENTRY_CACHE_HIT_RATIO = "entryCacheHitRatio"; 122 123 124 125 /** 126 * The name of the attribute that holds the maximum cache size in bytes. 127 */ 128 private static final String ATTR_MAX_ENTRY_CACHE_SIZE = "maxEntryCacheSize"; 129 130 131 132 /** 133 * The name of the attribute that holds the number of entries currently in the 134 * cache. 135 */ 136 private static final String ATTR_CURRENT_ENTRY_CACHE_COUNT = 137 "currentEntryCacheCount"; 138 139 140 141 /** 142 * The name of the attribute that holds the maximum number of entries that may 143 * be held in the cache. 144 */ 145 private static final String ATTR_MAX_ENTRY_CACHE_COUNT = "maxEntryCacheCount"; 146 147 148 149 /** 150 * The name of the attribute that holds the number of entries added to or 151 * replaced in the cache. 152 */ 153 private static final String ATTR_ENTRIES_ADDED_OR_UPDATED = 154 "entriesAddedOrUpdated"; 155 156 157 158 /** 159 * The name of the attribute that holds the number of entries evicted because 160 * the entry cache had reached its maximum memory allocation. 161 */ 162 private static final String ATTR_EVICTIONS_DUE_TO_MAX_MEMORY = 163 "evictionsDueToMaxMemory"; 164 165 166 167 /** 168 * The name of the attribute that holds the number of entries evicted because 169 * the entry cache had reached its maximum entry count. 170 */ 171 private static final String ATTR_EVICTIONS_DUE_TO_MAX_ENTRIES = 172 "evictionsDueToMaxEntries"; 173 174 175 176 /** 177 * The name of the attribute that holds the number of entries that were not 178 * added because they were already present in the cache. 179 */ 180 private static final String ATTR_ENTRIES_NOT_ADDED_ALREADY_PRESENT = 181 "entriesNotAddedAlreadyPresent"; 182 183 184 185 /** 186 * The name of the attribute that holds the number of entries that were not 187 * added because the cache had reached its maximum memory allocation. 188 */ 189 private static final String ATTR_ENTRIES_NOT_ADDED_DUE_TO_MAX_MEMORY = 190 "entriesNotAddedDueToMaxMemory"; 191 192 193 194 /** 195 * The name of the attribute that holds the number of entries that were not 196 * added because they did not meet the necessary filter criteria. 197 */ 198 private static final String ATTR_ENTRIES_NOT_ADDED_DUE_TO_FILTER = 199 "entriesNotAddedDueToFilter"; 200 201 202 203 /** 204 * The name of the attribute that holds the number of entries that were not 205 * added because they did not have enough values to be considered for 206 * inclusion in the cache. 207 */ 208 private static final String ATTR_ENTRIES_NOT_ADDED_DUE_TO_ENTRY_SMALLNESS = 209 "entriesNotAddedDueToEntrySmallness"; 210 211 212 213 /** 214 * The name of the attribute that holds the number of times that entries were 215 * purged from the cache because the JVM was running low on memory. 216 */ 217 private static final String ATTR_LOW_MEMORY_OCCURRENCES = 218 "lowMemoryOccurrences"; 219 220 221 222 /** 223 * The name of the attribute that holds the percentage of the maximum allowed 224 * number of entries that are currently held in the cache. 225 */ 226 private static final String ATTR_PERCENT_FULL_MAX_ENTRIES = 227 "percentFullMaxEntries"; 228 229 230 231 /** 232 * The name of the attribute that holds the maximum percent of JVM memory that 233 * may be consumed before entries may stop being added to the cache. 234 */ 235 private static final String ATTR_JVM_MEMORY_MAX_PERCENT_THRESHOLD = 236 "jvmMemoryMaxPercentThreshold"; 237 238 239 240 /** 241 * The name of the attribute that holds the percent of JVM memory that is 242 * currently consumed. 243 */ 244 private static final String ATTR_JVM_MEMORY_CURRENT_PERCENT_FULL = 245 "jvmMemoryCurrentPercentFull"; 246 247 248 249 /** 250 * The name of the attribute that holds the difference between the maximum 251 * memory percent threshold and the current percent full. 252 */ 253 private static final String ATTR_JVM_MEMORY_BELOW_MAX_MEMORY_PERCENT = 254 "jvmMemoryBelowMaxMemoryPercent"; 255 256 257 258 /** 259 * The name of the attribute that indicates whether the entry cache is 260 * currently full (based on memory usage or number of entries). 261 */ 262 private static final String ATTR_IS_FULL = "isFull"; 263 264 265 266 /** 267 * The name of the attribute that holds a human-readable message about the 268 * capacity and utilization of the cache. 269 */ 270 private static final String ATTR_CAPACITY_DETAILS = "capacityDetails"; 271 272 273 274 /** 275 * The serial version UID for this serializable class. 276 */ 277 private static final long serialVersionUID = -3340643698412829407L; 278 279 280 281 // The value of the isFull attribute. 282 private final Boolean isFull; 283 284 // The value of the currentEntryCacheCount attribute. 285 private final Long currentEntryCacheCount; 286 287 // The value of the entriesAddedOrUpdated attribute. 288 private final Long entriesAddedOrUpdated; 289 290 // The value of the entriesNotAddedAlreadyPresent attribute. 291 private final Long entriesNotAddedAlreadyPresent; 292 293 // The value of the entriesNotAddedDueToEntrySmallness attribute. 294 private final Long entriesNotAddedDueToEntrySmallness; 295 296 // The value of the entriesNotAddedDueToFilter attribute. 297 private final Long entriesNotAddedDueToFilter; 298 299 // The value of the entriesNotAddedDueToMaxMemory attribute. 300 private final Long entriesNotAddedDueToMaxMemory; 301 302 // The value of the entryCacheHitRatio attribute. 303 private final Long entryCacheHitRatio; 304 305 // The value of the entryCacheHits attribute. 306 private final Long entryCacheHits; 307 308 // The value of the entryCacheTries attribute. 309 private final Long entryCacheTries; 310 311 // The value of the evictionsDueToMaxEntries attribute. 312 private final Long evictionsDueToMaxEntries; 313 314 // The value of the evictionsDueToMaxMemory attribute. 315 private final Long evictionsDueToMaxMemory; 316 317 // The value of the jvmMemoryBelowMaxMemoryPercent attribute. 318 private final Long jvmMemoryBelowMaxMemoryPercent; 319 320 // The value of the jvmMemoryCurrentPercentFull attribute. 321 private final Long jvmMemoryCurrentPercentFull; 322 323 // The value of the jvmMemoryMaxPercentThreshold attribute. 324 private final Long jvmMemoryMaxPercentThreshold; 325 326 // The value of the lowMemoryOccurrences attribute. 327 private final Long lowMemoryOccurrences; 328 329 // The value of the maxEntryCacheCount attribute. 330 private final Long maxEntryCacheCount; 331 332 // The value of the maxEntryCacheSize attribute. 333 private final Long maxEntryCacheSize; 334 335 // The value of the percentFullMaxEntries attribute. 336 private final Long percentFullMaxEntries; 337 338 // The value of the cacheName attribute. 339 private final String cacheName; 340 341 // The value of the capacityDetails attribute. 342 private final String capacityDetails; 343 344 345 346 /** 347 * Creates a new FIFO entry cache monitor entry from the provided entry. 348 * 349 * @param entry The entry to be parsed as a FIFO entry cache monitor entry. 350 * It must not be {@code null}. 351 */ 352 public FIFOEntryCacheMonitorEntry(final Entry entry) 353 { 354 super(entry); 355 356 isFull = getBoolean(ATTR_IS_FULL); 357 currentEntryCacheCount = getLong(ATTR_CURRENT_ENTRY_CACHE_COUNT); 358 entriesAddedOrUpdated = getLong(ATTR_ENTRIES_ADDED_OR_UPDATED); 359 entriesNotAddedAlreadyPresent = 360 getLong(ATTR_ENTRIES_NOT_ADDED_ALREADY_PRESENT); 361 entriesNotAddedDueToEntrySmallness = 362 getLong(ATTR_ENTRIES_NOT_ADDED_DUE_TO_ENTRY_SMALLNESS); 363 entriesNotAddedDueToFilter = getLong(ATTR_ENTRIES_NOT_ADDED_DUE_TO_FILTER); 364 entriesNotAddedDueToMaxMemory = 365 getLong(ATTR_ENTRIES_NOT_ADDED_DUE_TO_MAX_MEMORY); 366 entryCacheHitRatio = getLong(ATTR_ENTRY_CACHE_HIT_RATIO); 367 entryCacheHits = getLong(ATTR_ENTRY_CACHE_HITS); 368 entryCacheTries = getLong(ATTR_ENTRY_CACHE_TRIES); 369 evictionsDueToMaxEntries = getLong(ATTR_EVICTIONS_DUE_TO_MAX_ENTRIES); 370 evictionsDueToMaxMemory = getLong(ATTR_EVICTIONS_DUE_TO_MAX_MEMORY); 371 jvmMemoryBelowMaxMemoryPercent = 372 getLong(ATTR_JVM_MEMORY_BELOW_MAX_MEMORY_PERCENT); 373 jvmMemoryCurrentPercentFull = getLong(ATTR_JVM_MEMORY_CURRENT_PERCENT_FULL); 374 jvmMemoryMaxPercentThreshold = 375 getLong(ATTR_JVM_MEMORY_MAX_PERCENT_THRESHOLD); 376 lowMemoryOccurrences = getLong(ATTR_LOW_MEMORY_OCCURRENCES); 377 maxEntryCacheCount = getLong(ATTR_MAX_ENTRY_CACHE_COUNT); 378 maxEntryCacheSize = getLong(ATTR_MAX_ENTRY_CACHE_SIZE); 379 percentFullMaxEntries = getLong(ATTR_PERCENT_FULL_MAX_ENTRIES); 380 cacheName = getString(ATTR_CACHE_NAME); 381 capacityDetails = getString(ATTR_CAPACITY_DETAILS); 382 } 383 384 385 386 /** 387 * Retrieves the name of the associated FIFO entry cache. 388 * 389 * @return The name of the associated FIFO entry cache, or {@code null} if 390 * this was not included in the monitor entry. 391 */ 392 public String getCacheName() 393 { 394 return cacheName; 395 } 396 397 398 399 /** 400 * Retrieves the number of times that a requested entry was successfully found 401 * in the cache. 402 * 403 * @return The number of times that a requested entry was successfully found 404 * in the cache, or {@code null} if this was not included in the 405 * monitor entry. 406 */ 407 public Long getEntryCacheHits() 408 { 409 return entryCacheHits; 410 } 411 412 413 414 /** 415 * Retrieves the number of times that an attempt was made to retrieve an entry 416 * from the cache. 417 * 418 * @return The number of times that an attempt was made to retrieve an entry 419 * from the cache, or {@code null} if this was not included in the 420 * monitor entry. 421 */ 422 public Long getEntryCacheTries() 423 { 424 return entryCacheTries; 425 } 426 427 428 429 /** 430 * Retrieves the percentage of the time that a requested entry was 431 * successfully retrieved from the cache. 432 * 433 * @return The percentage of the time that a requested entry was successfully 434 * retrieved from the cache, or {@code null} if this was not included 435 * in the monitor entry. 436 */ 437 public Long getEntryCacheHitRatio() 438 { 439 return entryCacheHitRatio; 440 } 441 442 443 444 /** 445 * Retrieves the maximum amount of memory (in bytes) that the entry cache may 446 * consume. 447 * 448 * @return The maximum amount of memory (in bytes) that the entry cache may 449 * consume, or {@code null} if this was not included in the monitor 450 * entry. 451 */ 452 public Long getMaxEntryCacheSizeBytes() 453 { 454 return maxEntryCacheSize; 455 } 456 457 458 459 /** 460 * Retrieves the number of entries currently held in the entry cache. 461 * 462 * @return The number of entries currently held in the entry cache, or 463 * {@code null} if this was not included in the monitor entry. 464 */ 465 public Long getCurrentEntryCacheCount() 466 { 467 return currentEntryCacheCount; 468 } 469 470 471 472 /** 473 * Retrieves the maximum number of entries that may be held in the entry 474 * cache. 475 * 476 * @return The maximum number of entries that may be held in the entry cache, 477 * or {@code null} if this was not included in the monitor entry. 478 */ 479 public Long getMaxEntryCacheCount() 480 { 481 return maxEntryCacheCount; 482 } 483 484 485 486 /** 487 * Retrieves the total number of entries that have been added to or updated 488 * in the cache since it was enabled. 489 * 490 * @return The total number of entries that have been added to or updated in 491 * the cache since it was enabled, or {@code null} if this was not 492 * included in the monitor entry. 493 */ 494 public Long getEntriesAddedOrUpdated() 495 { 496 return entriesAddedOrUpdated; 497 } 498 499 500 501 /** 502 * Retrieves the number of times that an entry has been evicted from the cache 503 * because the maximum memory consumption had been reached. 504 * 505 * @return The number of times that an entry has been evicted from the cache 506 * because the maximum memory consumption had been reached, or 507 * {@code null} if this was not included in the monitor entry. 508 */ 509 public Long getEvictionsDueToMaxMemory() 510 { 511 return evictionsDueToMaxMemory; 512 } 513 514 515 516 /** 517 * Retrieves the maximum number of times that an entry has been evicted from 518 * the cache because it already contained the maximum number of entries. 519 * 520 * @return The maximum number of times that an entry has been evicted from 521 * the cache because it already contained the maximum number of 522 * entries, or {@code null} if this was not included in the monitor 523 * entry. 524 */ 525 public Long getEvictionsDueToMaxEntries() 526 { 527 return evictionsDueToMaxEntries; 528 } 529 530 531 532 /** 533 * Retrieves the number of times that an entry was not added to the cache 534 * because it was already present. 535 * 536 * @return The number of times that an entry was not added to the cache 537 * because it was already present, or {@code null} if this was not 538 * included in the monitor entry. 539 */ 540 public Long getEntriesNotAddedAlreadyPresent() 541 { 542 return entriesNotAddedAlreadyPresent; 543 } 544 545 546 547 /** 548 * Retrieves the number of times that an entry was not added to the cache 549 * because it was already at its maximum memory consumption. 550 * 551 * @return The number of times that an entry was not added to the cache 552 * because it was already at its maximum memory consumption, or 553 * {@code null} if this was not included in the monitor entry. 554 */ 555 public Long getEntriesNotAddedDueToMaxMemory() 556 { 557 return entriesNotAddedDueToMaxMemory; 558 } 559 560 561 562 /** 563 * Retrieves the number of times that an entry was not added to the cache 564 * because it did not match the filter criteria for including it. 565 * 566 * @return The number of times that an entry was not added to the cache 567 * because it did not match the filter criteria for including it, or 568 * {@code null} if this was not included in the monitor entry. 569 */ 570 public Long getEntriesNotAddedDueToFilter() 571 { 572 return entriesNotAddedDueToFilter; 573 } 574 575 576 577 /** 578 * Retrieves the number of times that an entry was not added to the cache 579 * because it did not have enough values to be considered for inclusion. 580 * 581 * @return The number of times that an entry was not added to the cache 582 * because it did not have enough values to be considered for 583 * inclusion, or {@code null} if this was not included in the monitor 584 * entry. 585 */ 586 public Long getEntriesNotAddedDueToEntrySmallness() 587 { 588 return entriesNotAddedDueToEntrySmallness; 589 } 590 591 592 593 /** 594 * Retrieves the number of times that entries had to be evicted from the 595 * cache because the available JVM memory became critically low. 596 * 597 * @return The number of times that entries had to be evicted from the cache 598 * because the available JVM memory had become critically low, or 599 * {@code null} if this was not included in the monitor entry. 600 */ 601 public Long getLowMemoryOccurrences() 602 { 603 return lowMemoryOccurrences; 604 } 605 606 607 608 /** 609 * Retrieves the percentage of the maximum allowed number of entries that are 610 * currently held in the cache. 611 * 612 * @return The percentage of the maximum allowed number of entries that are 613 * currently held in the cache, or {@code null} if this was not 614 * included in the monitor entry. 615 */ 616 public Long getPercentFullMaxEntries() 617 { 618 return percentFullMaxEntries; 619 } 620 621 622 623 /** 624 * Retrieves the maximum percent of JVM memory that may be consumed in order 625 * for new entries to be added to the cache. 626 * 627 * @return The maximum percent of JVM memory that may be consumed in order 628 * for new entries to be added to the cache, or {@code null} if this 629 * was not included in the monitor entry. 630 */ 631 public Long getJVMMemoryMaxPercentThreshold() 632 { 633 return jvmMemoryMaxPercentThreshold; 634 } 635 636 637 638 /** 639 * Retrieves the percentage of JVM memory that is currently being consumed. 640 * 641 * @return The percentage of JVM memory that is currently being consumed, or 642 * {@code null} if this was not included in the monitor entry. 643 */ 644 public Long getJVMMemoryCurrentPercentFull() 645 { 646 return jvmMemoryCurrentPercentFull; 647 } 648 649 650 651 /** 652 * Retrieves the difference between the JVM max memory percent threshold and 653 * the JVM memory current percent full. Note that this value may be negative 654 * if the JVM is currently consuming more memory than the maximum threshold. 655 * 656 * @return The difference between the JVM max memory percent threshold and 657 * the JVM memory current percent full, or {@code null} if this was 658 * not included in the monitor entry. 659 */ 660 public Long getJVMMemoryBelowMaxMemoryPercent() 661 { 662 return jvmMemoryBelowMaxMemoryPercent; 663 } 664 665 666 667 /** 668 * Indicates whether the entry cache is currently full, whether due to the 669 * maximum JVM memory consumption or the maximum number of entries allowed in 670 * the cache. 671 * 672 * @return {@code Boolean.TRUE} if the entry cache is currently full, 673 * {@code Boolean.FALSE} if the entry cache is not yet full, or 674 * {@code null} if this was not included in the monitor entry. 675 */ 676 public Boolean isFull() 677 { 678 return isFull; 679 } 680 681 682 683 /** 684 * Retrieves a human-readable message about the capacity and utilization of 685 * the entry cache. 686 * 687 * @return A human-readable message about the capacity and utilization of the 688 * entry cache, or {@code null} if this was not included in the 689 * monitor entry. 690 */ 691 public String getCapacityDetails() 692 { 693 return capacityDetails; 694 } 695 696 697 698 /** 699 * {@inheritDoc} 700 */ 701 @Override() 702 public String getMonitorDisplayName() 703 { 704 return INFO_FIFO_ENTRY_CACHE_MONITOR_DISPNAME.get(); 705 } 706 707 708 709 /** 710 * {@inheritDoc} 711 */ 712 @Override() 713 public String getMonitorDescription() 714 { 715 return INFO_FIFO_ENTRY_CACHE_MONITOR_DESC.get(); 716 } 717 718 719 720 /** 721 * {@inheritDoc} 722 */ 723 @Override() 724 public Map<String,MonitorAttribute> getMonitorAttributes() 725 { 726 final LinkedHashMap<String,MonitorAttribute> attrs = 727 new LinkedHashMap<>(StaticUtils.computeMapCapacity(30)); 728 729 if (cacheName != null) 730 { 731 addMonitorAttribute(attrs, 732 ATTR_CACHE_NAME, 733 INFO_FIFO_ENTRY_CACHE_DISPNAME_CACHE_NAME.get(), 734 INFO_FIFO_ENTRY_CACHE_DESC_CACHE_NAME.get(), 735 cacheName); 736 } 737 738 if (entryCacheHits != null) 739 { 740 addMonitorAttribute(attrs, 741 ATTR_ENTRY_CACHE_HITS, 742 INFO_FIFO_ENTRY_CACHE_DISPNAME_HITS.get(), 743 INFO_FIFO_ENTRY_CACHE_DESC_HITS.get(), 744 entryCacheHits); 745 } 746 747 if (entryCacheTries != null) 748 { 749 addMonitorAttribute(attrs, 750 ATTR_ENTRY_CACHE_TRIES, 751 INFO_FIFO_ENTRY_CACHE_DISPNAME_TRIES.get(), 752 INFO_FIFO_ENTRY_CACHE_DESC_TRIES.get(), 753 entryCacheTries); 754 } 755 756 if (entryCacheHitRatio != null) 757 { 758 addMonitorAttribute(attrs, 759 ATTR_ENTRY_CACHE_HIT_RATIO, 760 INFO_FIFO_ENTRY_CACHE_DISPNAME_HIT_RATIO.get(), 761 INFO_FIFO_ENTRY_CACHE_DESC_HIT_RATIO.get(), 762 entryCacheHitRatio); 763 } 764 765 if (maxEntryCacheSize != null) 766 { 767 addMonitorAttribute(attrs, 768 ATTR_MAX_ENTRY_CACHE_SIZE, 769 INFO_FIFO_ENTRY_CACHE_DISPNAME_MAX_MEM.get(), 770 INFO_FIFO_ENTRY_CACHE_DESC_MAX_MEM.get(), 771 maxEntryCacheSize); 772 } 773 774 if (currentEntryCacheCount != null) 775 { 776 addMonitorAttribute(attrs, 777 ATTR_CURRENT_ENTRY_CACHE_COUNT, 778 INFO_FIFO_ENTRY_CACHE_DISPNAME_CURRENT_COUNT.get(), 779 INFO_FIFO_ENTRY_CACHE_DESC_CURRENT_COUNT.get(), 780 currentEntryCacheCount); 781 } 782 783 if (maxEntryCacheCount != null) 784 { 785 addMonitorAttribute(attrs, 786 ATTR_MAX_ENTRY_CACHE_COUNT, 787 INFO_FIFO_ENTRY_CACHE_DISPNAME_MAX_COUNT.get(), 788 INFO_FIFO_ENTRY_CACHE_DESC_MAX_COUNT.get(), 789 maxEntryCacheCount); 790 } 791 792 if (entriesAddedOrUpdated != null) 793 { 794 addMonitorAttribute(attrs, 795 ATTR_ENTRIES_ADDED_OR_UPDATED, 796 INFO_FIFO_ENTRY_CACHE_DISPNAME_PUT_COUNT.get(), 797 INFO_FIFO_ENTRY_CACHE_DESC_PUT_COUNT.get(), 798 entriesAddedOrUpdated); 799 } 800 801 if (evictionsDueToMaxMemory != null) 802 { 803 addMonitorAttribute(attrs, 804 ATTR_EVICTIONS_DUE_TO_MAX_MEMORY, 805 INFO_FIFO_ENTRY_CACHE_DISPNAME_EVICT_MEM.get(), 806 INFO_FIFO_ENTRY_CACHE_DESC_EVICT_MEM.get(), 807 evictionsDueToMaxMemory); 808 } 809 810 if (evictionsDueToMaxEntries != null) 811 { 812 addMonitorAttribute(attrs, 813 ATTR_EVICTIONS_DUE_TO_MAX_ENTRIES, 814 INFO_FIFO_ENTRY_CACHE_DISPNAME_EVICT_COUNT.get(), 815 INFO_FIFO_ENTRY_CACHE_DESC_EVICT_COUNT.get(), 816 evictionsDueToMaxEntries); 817 } 818 819 if (entriesNotAddedAlreadyPresent != null) 820 { 821 addMonitorAttribute(attrs, 822 ATTR_ENTRIES_NOT_ADDED_ALREADY_PRESENT, 823 INFO_FIFO_ENTRY_CACHE_DISPNAME_NO_PUT_ALREADY_PRESENT.get(), 824 INFO_FIFO_ENTRY_CACHE_DESC_NO_PUT_ALREADY_PRESENT.get(), 825 entriesNotAddedAlreadyPresent); 826 } 827 828 if (entriesNotAddedDueToMaxMemory != null) 829 { 830 addMonitorAttribute(attrs, 831 ATTR_ENTRIES_NOT_ADDED_DUE_TO_MAX_MEMORY, 832 INFO_FIFO_ENTRY_CACHE_DISPNAME_NO_PUT_MEM.get(), 833 INFO_FIFO_ENTRY_CACHE_DESC_NO_PUT_MEM.get(), 834 entriesNotAddedDueToMaxMemory); 835 } 836 837 if (entriesNotAddedDueToFilter != null) 838 { 839 addMonitorAttribute(attrs, 840 ATTR_ENTRIES_NOT_ADDED_DUE_TO_FILTER, 841 INFO_FIFO_ENTRY_CACHE_DISPNAME_NO_PUT_FILTER.get(), 842 INFO_FIFO_ENTRY_CACHE_DESC_NO_PUT_FILTER.get(), 843 entriesNotAddedDueToFilter); 844 } 845 846 if (entriesNotAddedDueToEntrySmallness != null) 847 { 848 addMonitorAttribute(attrs, 849 ATTR_ENTRIES_NOT_ADDED_DUE_TO_ENTRY_SMALLNESS, 850 INFO_FIFO_ENTRY_CACHE_DISPNAME_NO_PUT_TOO_SMALL.get(), 851 INFO_FIFO_ENTRY_CACHE_DESC_NO_PUT_TOO_SMALL.get(), 852 entriesNotAddedDueToEntrySmallness); 853 } 854 855 if (lowMemoryOccurrences != null) 856 { 857 addMonitorAttribute(attrs, 858 ATTR_LOW_MEMORY_OCCURRENCES, 859 INFO_FIFO_ENTRY_CACHE_DISPNAME_LOW_MEM_COUNT.get(), 860 INFO_FIFO_ENTRY_CACHE_DESC_LOW_MEM_COUNT.get(), 861 lowMemoryOccurrences); 862 } 863 864 if (percentFullMaxEntries != null) 865 { 866 addMonitorAttribute(attrs, 867 ATTR_PERCENT_FULL_MAX_ENTRIES, 868 INFO_FIFO_ENTRY_CACHE_DISPNAME_ENTRY_COUNT_PERCENT.get(), 869 INFO_FIFO_ENTRY_CACHE_DESC_ENTRY_COUNT_PERCENT.get(), 870 percentFullMaxEntries); 871 } 872 873 if (jvmMemoryMaxPercentThreshold != null) 874 { 875 addMonitorAttribute(attrs, 876 ATTR_JVM_MEMORY_MAX_PERCENT_THRESHOLD, 877 INFO_FIFO_ENTRY_CACHE_DISPNAME_JVM_MEM_MAX_PERCENT.get(), 878 INFO_FIFO_ENTRY_CACHE_DESC_JVM_MEM_MAX_PERCENT.get(), 879 jvmMemoryMaxPercentThreshold); 880 } 881 882 if (jvmMemoryCurrentPercentFull != null) 883 { 884 addMonitorAttribute(attrs, 885 ATTR_JVM_MEMORY_CURRENT_PERCENT_FULL, 886 INFO_FIFO_ENTRY_CACHE_DISPNAME_JVM_MEM_CURRENT_PERCENT.get(), 887 INFO_FIFO_ENTRY_CACHE_DESC_JVM_MEM_CURRENT_PERCENT.get(), 888 jvmMemoryCurrentPercentFull); 889 } 890 891 if (jvmMemoryBelowMaxMemoryPercent != null) 892 { 893 addMonitorAttribute(attrs, 894 ATTR_JVM_MEMORY_BELOW_MAX_MEMORY_PERCENT, 895 INFO_FIFO_ENTRY_CACHE_DISPNAME_JVM_MEM_BELOW_MAX_PERCENT.get(), 896 INFO_FIFO_ENTRY_CACHE_DESC_JVM_MEM_BELOW_MAX_PERCENT.get(), 897 jvmMemoryBelowMaxMemoryPercent); 898 } 899 900 if (isFull != null) 901 { 902 addMonitorAttribute(attrs, 903 ATTR_IS_FULL, 904 INFO_FIFO_ENTRY_CACHE_DISPNAME_IS_FULL.get(), 905 INFO_FIFO_ENTRY_CACHE_DESC_IS_FULL.get(), 906 isFull); 907 } 908 909 if (capacityDetails != null) 910 { 911 addMonitorAttribute(attrs, 912 ATTR_CAPACITY_DETAILS, 913 INFO_FIFO_ENTRY_CACHE_DISPNAME_CAPACITY_DETAILS.get(), 914 INFO_FIFO_ENTRY_CACHE_DESC_CAPACITY_DETAILS.get(), 915 capacityDetails); 916 } 917 918 return Collections.unmodifiableMap(attrs); 919 } 920}