Class CacheManagerImpl

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable, javax.cache.CacheManager

    public final class CacheManagerImpl
    extends java.lang.Object
    implements javax.cache.CacheManager
    An implementation of JSR-107 CacheManager that manages Caffeine-based caches.
    • Constructor Summary

      Constructors 
      Constructor Description
      CacheManagerImpl​(javax.cache.spi.CachingProvider cacheProvider, java.net.URI uri, java.lang.ClassLoader classLoader, java.util.Properties properties)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      <K,​V,​C extends javax.cache.configuration.Configuration<K,​V>>
      javax.cache.Cache<K,​V>
      createCache​(java.lang.String cacheName, C configuration)  
      void destroyCache​(java.lang.String cacheName)  
      void enableManagement​(java.lang.String cacheName, boolean enabled)  
      void enableStatistics​(java.lang.String cacheName, boolean enabled)  
      <K,​V>
      CacheProxy<K,​V>
      getCache​(java.lang.String cacheName)  
      <K,​V>
      @Nullable javax.cache.Cache<K,​V>
      getCache​(java.lang.String cacheName, java.lang.Class<K> keyType, java.lang.Class<V> valueType)  
      java.lang.Iterable<java.lang.String> getCacheNames()  
      javax.cache.spi.CachingProvider getCachingProvider()  
      @Nullable java.lang.ClassLoader getClassLoader()  
      java.util.Properties getProperties()  
      java.net.URI getURI()  
      boolean isClosed()  
      private void requireNotClosed()
      Checks that the cache manager is not closed.
      <T> T unwrap​(java.lang.Class<T> clazz)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • classLoaderReference

        private final java.lang.ref.WeakReference<java.lang.ClassLoader> classLoaderReference
      • caches

        private final java.util.Map<java.lang.String,​CacheProxy<?,​?>> caches
      • cacheProvider

        private final javax.cache.spi.CachingProvider cacheProvider
      • properties

        private final java.util.Properties properties
      • uri

        private final java.net.URI uri
      • runsAsAnOsgiBundle

        private final boolean runsAsAnOsgiBundle
      • closed

        private volatile boolean closed
    • Constructor Detail

      • CacheManagerImpl

        public CacheManagerImpl​(javax.cache.spi.CachingProvider cacheProvider,
                                java.net.URI uri,
                                java.lang.ClassLoader classLoader,
                                java.util.Properties properties)
    • Method Detail

      • getCachingProvider

        public javax.cache.spi.CachingProvider getCachingProvider()
        Specified by:
        getCachingProvider in interface javax.cache.CacheManager
      • getURI

        public java.net.URI getURI()
        Specified by:
        getURI in interface javax.cache.CacheManager
      • getClassLoader

        public @Nullable java.lang.ClassLoader getClassLoader()
        Specified by:
        getClassLoader in interface javax.cache.CacheManager
      • getProperties

        public java.util.Properties getProperties()
        Specified by:
        getProperties in interface javax.cache.CacheManager
      • createCache

        public <K,​V,​C extends javax.cache.configuration.Configuration<K,​V>> javax.cache.Cache<K,​V> createCache​(java.lang.String cacheName,
                                                                                                                                       C configuration)
        Specified by:
        createCache in interface javax.cache.CacheManager
      • getCache

        public <K,​V> @Nullable javax.cache.Cache<K,​V> getCache​(java.lang.String cacheName,
                                                                           java.lang.Class<K> keyType,
                                                                           java.lang.Class<V> valueType)
        Specified by:
        getCache in interface javax.cache.CacheManager
      • getCache

        public <K,​V> CacheProxy<K,​V> getCache​(java.lang.String cacheName)
        Specified by:
        getCache in interface javax.cache.CacheManager
      • getCacheNames

        public java.lang.Iterable<java.lang.String> getCacheNames()
        Specified by:
        getCacheNames in interface javax.cache.CacheManager
      • destroyCache

        public void destroyCache​(java.lang.String cacheName)
        Specified by:
        destroyCache in interface javax.cache.CacheManager
      • enableManagement

        public void enableManagement​(java.lang.String cacheName,
                                     boolean enabled)
        Specified by:
        enableManagement in interface javax.cache.CacheManager
      • enableStatistics

        public void enableStatistics​(java.lang.String cacheName,
                                     boolean enabled)
        Specified by:
        enableStatistics in interface javax.cache.CacheManager
      • close

        public void close()
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface javax.cache.CacheManager
        Specified by:
        close in interface java.io.Closeable
      • isClosed

        public boolean isClosed()
        Specified by:
        isClosed in interface javax.cache.CacheManager
      • unwrap

        public <T> T unwrap​(java.lang.Class<T> clazz)
        Specified by:
        unwrap in interface javax.cache.CacheManager
      • requireNotClosed

        private void requireNotClosed()
        Checks that the cache manager is not closed.