diff options
author | 2020-11-19 18:12:50 -0500 | |
---|---|---|
committer | 2020-11-19 18:12:51 -0500 | |
commit | a16231657fe29334a589c98290ac8b6b2710a144 (patch) | |
tree | 475dc51d396789aff10d5a63143350a4b8a2d762 /graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/CacheLogger.java | |
parent | b029a27f327851e73ceff94595cbb1e099da8998 (diff) |
add caching to graph inventory client
add caching to graph inventory client
updated properties files to read cache properties
Issue-ID: SO-3398
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: Ib3e67ae014b6668c9b004aae1e8b5d49b9ce6b06
Diffstat (limited to 'graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/CacheLogger.java')
-rw-r--r-- | graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/CacheLogger.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/CacheLogger.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/CacheLogger.java new file mode 100644 index 0000000000..f3dc610125 --- /dev/null +++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/CacheLogger.java @@ -0,0 +1,53 @@ +package org.onap.aaiclient.client; + +import java.io.Serializable; +import javax.cache.event.CacheEntryCreatedListener; +import javax.cache.event.CacheEntryEvent; +import javax.cache.event.CacheEntryExpiredListener; +import javax.cache.event.CacheEntryListenerException; +import javax.cache.event.CacheEntryRemovedListener; +import javax.cache.event.CacheEntryUpdatedListener; +import org.apache.cxf.jaxrs.client.cache.Entry; +import org.apache.cxf.jaxrs.client.cache.Key; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CacheLogger implements CacheEntryExpiredListener<Key, Entry>, CacheEntryCreatedListener<Key, Entry>, + CacheEntryUpdatedListener<Key, Entry>, CacheEntryRemovedListener<Key, Entry>, Serializable { + + private static final long serialVersionUID = 1L; + private static final Logger logger = LoggerFactory.getLogger(CacheLogger.class); + + @Override + public void onExpired(Iterable<CacheEntryEvent<? extends Key, ? extends Entry>> events) + throws CacheEntryListenerException { + for (CacheEntryEvent<? extends Key, ? extends Entry> event : events) { + logger.debug("{} expired key: {}", event.getSource().getName(), event.getKey().getUri()); + } + } + + @Override + public void onRemoved(Iterable<CacheEntryEvent<? extends Key, ? extends Entry>> events) + throws CacheEntryListenerException { + for (CacheEntryEvent<? extends Key, ? extends Entry> event : events) { + logger.debug("{} removed key: {}", event.getSource().getName(), event.getKey().getUri()); + } + } + + @Override + public void onUpdated(Iterable<CacheEntryEvent<? extends Key, ? extends Entry>> events) + throws CacheEntryListenerException { + for (CacheEntryEvent<? extends Key, ? extends Entry> event : events) { + logger.debug("{} updated key: {}", event.getSource().getName(), event.getKey().getUri()); + } + } + + @Override + public void onCreated(Iterable<CacheEntryEvent<? extends Key, ? extends Entry>> events) + throws CacheEntryListenerException { + for (CacheEntryEvent<? extends Key, ? extends Entry> event : events) { + logger.debug("{} created key: {}", event.getSource().getName(), event.getKey().getUri()); + } + } + +} |