Permalink
Browse files

Resolves Issue #8: Refactored Caching class, CachingProvider and Cach…

…eManager interfaces to support multiple CachingProvider instances with class loader isolation (removed need for CacheManagerFactory)

Resolves Issue #87: Removed Caching.isAnnotationsSupported() method.
  • Loading branch information...
1 parent e5aec66 commit 97ddbeb551f8b3ef27b18225874d5b201e45fbad Brian Oliver committed Mar 22, 2013
@@ -7,6 +7,7 @@
<!-- Suppress duplicate checking of copyright notice -->
<suppress checks="StrictDuplicateCode" files=".java" lines="1-6"/>
+
<!--Includes Configuration -->
<suppress checks="StrictDuplicateCode" files="CacheMXBean.java" lines="34-150" />
<suppress checks="StrictDuplicateCode" files="Configuration.java" lines="34-150" />
@@ -15,5 +16,8 @@
<suppress checks="ParenPad" files="[\\/]annotation[\\/]"/>
<suppress checks="MagicNumber" files=""/>
- <suppress checks="CyclomaticComplexity" files="MutableConfiguration.java"/> <suppress checks="NPathComplexity" files="MutableConfiguration.java"/>
+ <suppress checks="CyclomaticComplexity" files="MutableConfiguration.java"/>
+ <suppress checks="NPathComplexity" files="MutableConfiguration.java"/>
+
+ <suppress checks="IllegalType" files="Caching.java"/>
</suppressions>
@@ -7,7 +7,10 @@
package javax.cache;
+import javax.cache.spi.CachingProvider;
import javax.transaction.UserTransaction;
+import java.net.URI;
+import java.util.Properties;
/**
* A CacheManager is used for establishing, looking up and managing the lifecycle
@@ -42,11 +45,27 @@
public interface CacheManager {
/**
- * Get the name of this cache manager
+ * Obtain the CachingProvider that created and is responsible for
+ * this CacheManager.
*
- * @return the name of this cache manager
+ * @return the CachingProvider or <code>null</code> if the CacheManager
+ * was created without using a CachingProvider
*/
- String getName();
+ CachingProvider getCachingProvider();
+
+ /**
+ * Get the URI of this CacheManager.
+ *
+ * @return the URI of this CacheManager
+ */
+ URI getURI();
+
+ /**
+ * Get the Properties that were used to create this CacheManager.
+ *
+ * @return the Properties used to create the CacheManager
+ */
+ Properties getProperties();
/**
* Returns the status of this CacheManager.
@@ -186,7 +205,7 @@
/**
- * Shuts down the CacheManager.
+ * Closes the CacheManager.
* <p/>
* For each cache in the cache manager the {@link javax.cache.Cache#stop()}
* method will be invoked, in no guaranteed order.
@@ -202,7 +221,7 @@
*
* @throws IllegalStateException if an operation is performed on CacheManager while stopping or stopped.
*/
- void shutdown();
+ void close();
/**
* Return an object of the specified type to allow access to the provider-specific API. If the provider's
@@ -1,74 +0,0 @@
-/**
- * Copyright (c) 2011 Terracotta, Inc.
- * Copyright (c) 2011 Oracle and/or its affiliates.
- *
- * All rights reserved. Use is subject to license terms.
- */
-package javax.cache;
-
-/**
- * Manages CacheManager instances.
- *
- * It is invoked by the {@link javax.cache.Caching} class to create
- * a {@link CacheManager}
- * @author Yannis Cosmadopoulos
- * @since 1.0
- */
-public interface CacheManagerFactory {
- /**
- * Get a named cache manager using the default cache loader as specified by
- * the implementation.
- *
- * @param name the name of the cache manager
- * @return the named cache manager
- * @throws NullPointerException if name is null
- */
- CacheManager getCacheManager(String name);
-
- /**
- * Get the cache manager for the specified name and class loader.
- * <p/>
- * If there is no cache manager associated, it is created.
- *
- * @param classLoader associated with the cache manager.
- * @param name the name of the cache manager
- * @return the new cache manager
- * @throws NullPointerException if classLoader or name is null
- */
- CacheManager getCacheManager(ClassLoader classLoader, String name);
-
- /**
- * Reclaims all resources obtained from this factory.
- * <p/>
- * All cache managers obtained from the factory are shutdown.
- * <p/>
- * Subsequent requests from this factory will return different cache managers than would have been obtained before
- * shutdown.
- *
- * @throws javax.cache.CachingShutdownException if any of the individual shutdowns failed
- */
- void close() throws CachingShutdownException;
-
- /**
- * Reclaims all resources for a ClassLoader from this factory.
- * <p/>
- * All cache managers linked to the specified CacheLoader obtained from the factory are shutdown.
- *
- * @param classLoader the class loader for which managers will be shut down
- * @return true if found, false otherwise
- * @throws CachingShutdownException if any of the individual shutdowns failed
- */
- boolean close(ClassLoader classLoader) throws CachingShutdownException;
-
- /**
- * Reclaims all resources for a ClassLoader from this factory.
- * <p/>
- * the named cache manager obtained from the factory is shutdown.
- *
- * @param classLoader the class loader for which managers will be shut down
- * @param name the name of the cache manager
- * @return true if found, false otherwise
- * @throws CachingShutdownException if there is a problem shutting down a CacheManager
- */
- boolean close(ClassLoader classLoader, String name) throws CachingShutdownException;
-}
Oops, something went wrong.

0 comments on commit 97ddbeb

Please sign in to comment.