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