simplify cache api

This commit is contained in:
Sebastian Sdorra
2014-01-09 20:06:07 +01:00
parent 2e6748cb23
commit 908f2fe6c8
17 changed files with 107 additions and 209 deletions

View File

@@ -51,14 +51,11 @@ public interface CacheManager extends Closeable
* Returns the cache with the specified types and name. * Returns the cache with the specified types and name.
* If the cache does not exist, a new cache is created. * If the cache does not exist, a new cache is created.
* *
*
* @param key - The type of the keys for the cache
* @param value - The type of cache elements
* @param name - The name of the cache * @param name - The name of the cache
* @param <K> - The type of the keys for the cache * @param <K> - The type of the keys for the cache
* @param <V> - The type of cache elements * @param <V> - The type of cache elements
* *
* @return the cache with the specified types and name * @return the cache with the specified types and name
*/ */
public <K, V> Cache<K, V> getCache(Class<K> key, Class<V> value, String name); public <K, V> Cache<K, V> getCache(String name);
} }

View File

@@ -41,14 +41,13 @@ import sonia.scm.event.Event;
* Pre receive repository hook events are fired before a change is written * Pre receive repository hook events are fired before a change is written
* through the repository. This class is wrapper of {@link RepositoryHookEvent} * through the repository. This class is wrapper of {@link RepositoryHookEvent}
* for the event system of SCM-Manager. * for the event system of SCM-Manager.
*
* TODO: make final for version 2.0
* *
* @author Sebastian Sdorra * @author Sebastian Sdorra
* @since 1.23 * @since 1.23
*/ */
@Event @Event
public class PreReceiveRepositoryHookEvent extends WrappedRepositoryHookEvent public final class PreReceiveRepositoryHookEvent
extends WrappedRepositoryHookEvent
{ {
/** /**

View File

@@ -105,8 +105,7 @@ public final class BlameCommandBuilder
BlameCommandBuilder(CacheManager cacheManager, BlameCommand blameCommand, BlameCommandBuilder(CacheManager cacheManager, BlameCommand blameCommand,
Repository repository, PreProcessorUtil preProcessorUtil) Repository repository, PreProcessorUtil preProcessorUtil)
{ {
this.cache = cacheManager.getCache(CacheKey.class, BlameResult.class, this.cache = cacheManager.getCache(CACHE_NAME);
CACHE_NAME);
this.blameCommand = blameCommand; this.blameCommand = blameCommand;
this.repository = repository; this.repository = repository;
this.preProcessorUtil = preProcessorUtil; this.preProcessorUtil = preProcessorUtil;
@@ -151,7 +150,7 @@ public final class BlameCommandBuilder
requestClone.setPath(path); requestClone.setPath(path);
BlameResult result = null; BlameResult result;
if (disableCache) if (disableCache)
{ {
@@ -351,21 +350,21 @@ public final class BlameCommandBuilder
//~--- fields ------------------------------------------------------------- //~--- fields -------------------------------------------------------------
/** Field description */ /** repository id */
private String repositoryId; private final String repositoryId;
/** Field description */ /** request object */
private BlameCommandRequest request; private final BlameCommandRequest request;
} }
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** implementation of the blame command */ /** implementation of the blame command */
private BlameCommand blameCommand; private final BlameCommand blameCommand;
/** the cache */ /** the cache */
private Cache<CacheKey, BlameResult> cache; private final Cache<CacheKey, BlameResult> cache;
/** disable escaping */ /** disable escaping */
private boolean disableEscaping = false; private boolean disableEscaping = false;
@@ -377,11 +376,11 @@ public final class BlameCommandBuilder
private boolean disablePreProcessors = false; private boolean disablePreProcessors = false;
/** Field description */ /** Field description */
private PreProcessorUtil preProcessorUtil; private final PreProcessorUtil preProcessorUtil;
/** the repository */ /** the repository */
private Repository repository; private final Repository repository;
/** request for the blame command implementation */ /** request for the blame command implementation */
private BlameCommandRequest request = new BlameCommandRequest(); private final BlameCommandRequest request = new BlameCommandRequest();
} }

View File

@@ -94,8 +94,7 @@ public final class BranchesCommandBuilder
BranchesCommandBuilder(CacheManager cacheManager, BranchesCommandBuilder(CacheManager cacheManager,
BranchesCommand branchesCommand, Repository repository) BranchesCommand branchesCommand, Repository repository)
{ {
this.cache = cacheManager.getCache(CacheKey.class, Branches.class, this.cache = cacheManager.getCache(CACHE_NAME);
CACHE_NAME);
this.branchesCommand = branchesCommand; this.branchesCommand = branchesCommand;
this.repository = repository; this.repository = repository;
} }
@@ -113,7 +112,7 @@ public final class BranchesCommandBuilder
*/ */
public Branches getBranches() throws RepositoryException, IOException public Branches getBranches() throws RepositoryException, IOException
{ {
Branches branches = null; Branches branches;
if (disableCache) if (disableCache)
{ {
@@ -270,22 +269,22 @@ public final class BranchesCommandBuilder
//~--- fields ------------------------------------------------------------- //~--- fields -------------------------------------------------------------
/** Field description */ /** repository id */
private String repositoryId; private final String repositoryId;
} }
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** branches command implementation */ /** branches command implementation */
private BranchesCommand branchesCommand; private final BranchesCommand branchesCommand;
/** cache for branches */ /** cache for branches */
private Cache<CacheKey, Branches> cache; private final Cache<CacheKey, Branches> cache;
/** disable cache */ /** disable cache */
private boolean disableCache = false; private boolean disableCache = false;
/** repository */ /** repository */
private Repository repository; private final Repository repository;
} }

View File

@@ -108,8 +108,7 @@ public final class BrowseCommandBuilder
BrowseCommandBuilder(CacheManager cacheManager, BrowseCommand browseCommand, BrowseCommandBuilder(CacheManager cacheManager, BrowseCommand browseCommand,
Repository repository, PreProcessorUtil preProcessorUtil) Repository repository, PreProcessorUtil preProcessorUtil)
{ {
this.cache = cacheManager.getCache(CacheKey.class, BrowserResult.class, this.cache = cacheManager.getCache(CACHE_NAME);
CACHE_NAME);
this.browseCommand = browseCommand; this.browseCommand = browseCommand;
this.repository = repository; this.repository = repository;
this.preProcessorUtil = preProcessorUtil; this.preProcessorUtil = preProcessorUtil;
@@ -424,21 +423,21 @@ public final class BrowseCommandBuilder
//~--- fields ------------------------------------------------------------- //~--- fields -------------------------------------------------------------
/** Field description */ /** repository id */
private String repositoryId; private final String repositoryId;
/** Field description */ /** request object */
private BrowseCommandRequest request; private final BrowseCommandRequest request;
} }
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** implementation of the browse command */ /** implementation of the browse command */
private BrowseCommand browseCommand; private final BrowseCommand browseCommand;
/** cache */ /** cache */
private Cache<CacheKey, BrowserResult> cache; private final Cache<CacheKey, BrowserResult> cache;
/** disable escaping */ /** disable escaping */
private boolean disableEscaping = false; private boolean disableEscaping = false;
@@ -450,11 +449,11 @@ public final class BrowseCommandBuilder
private boolean disablePreProcessors = false; private boolean disablePreProcessors = false;
/** Field description */ /** Field description */
private PreProcessorUtil preProcessorUtil; private final PreProcessorUtil preProcessorUtil;
/** the repsitory */ /** the repsitory */
private Repository repository; private final Repository repository;
/** request for the command */ /** request for the command */
private BrowseCommandRequest request = new BrowseCommandRequest(); private final BrowseCommandRequest request = new BrowseCommandRequest();
} }

View File

@@ -116,8 +116,7 @@ public final class LogCommandBuilder
LogCommandBuilder(CacheManager cacheManager, LogCommand logCommand, LogCommandBuilder(CacheManager cacheManager, LogCommand logCommand,
Repository repository, PreProcessorUtil preProcessorUtil) Repository repository, PreProcessorUtil preProcessorUtil)
{ {
this.cache = cacheManager.getCache(CacheKey.class, this.cache = cacheManager.getCache(CACHE_NAME);
ChangesetPagingResult.class, CACHE_NAME);
this.logCommand = logCommand; this.logCommand = logCommand;
this.repository = repository; this.repository = repository;
this.preProcessorUtil = preProcessorUtil; this.preProcessorUtil = preProcessorUtil;
@@ -172,7 +171,7 @@ public final class LogCommandBuilder
public Changeset getChangeset(String id) public Changeset getChangeset(String id)
throws IOException, RepositoryException throws IOException, RepositoryException
{ {
Changeset changeset = null; Changeset changeset;
if (disableCache) if (disableCache)
{ {
@@ -234,7 +233,7 @@ public final class LogCommandBuilder
public ChangesetPagingResult getChangesets() public ChangesetPagingResult getChangesets()
throws IOException, RepositoryException throws IOException, RepositoryException
{ {
ChangesetPagingResult cpr = null; ChangesetPagingResult cpr;
if (disableCache) if (disableCache)
{ {
@@ -453,6 +452,7 @@ public final class LogCommandBuilder
{ {
this.repositoryId = repository.getId(); this.repositoryId = repository.getId();
this.request = request; this.request = request;
this.changesetId = null;
} }
/** /**
@@ -467,6 +467,7 @@ public final class LogCommandBuilder
{ {
this.repositoryId = repository.getId(); this.repositoryId = repository.getId();
this.changesetId = changesetId; this.changesetId = changesetId;
this.request = null;
} }
//~--- methods ------------------------------------------------------------ //~--- methods ------------------------------------------------------------
@@ -528,20 +529,29 @@ public final class LogCommandBuilder
//~--- fields ------------------------------------------------------------- //~--- fields -------------------------------------------------------------
/** Field description */ /** Field description */
private String changesetId; private final String changesetId;
/** Field description */ /** Field description */
private String repositoryId; private final String repositoryId;
/** Field description */ /** Field description */
private LogCommandRequest request; private final LogCommandRequest request;
} }
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** cache for changesets */ /** cache for changesets */
private Cache<CacheKey, ChangesetPagingResult> cache; private final Cache<CacheKey, ChangesetPagingResult> cache;
/** Implementation of the log command */
private final LogCommand logCommand;
/** Field description */
private final PreProcessorUtil preProcessorUtil;
/** repository to query */
private final Repository repository;
/** disable escaping */ /** disable escaping */
private boolean disableEscaping = false; private boolean disableEscaping = false;
@@ -552,15 +562,6 @@ public final class LogCommandBuilder
/** disable the execution of pre processors */ /** disable the execution of pre processors */
private boolean disablePreProcessors = false; private boolean disablePreProcessors = false;
/** Implementation of the log command */
private LogCommand logCommand;
/** Field description */
private PreProcessorUtil preProcessorUtil;
/** repository to query */
private Repository repository;
/** request for the log command */ /** request for the log command */
private LogCommandRequest request = new LogCommandRequest(); private final LogCommandRequest request = new LogCommandRequest();
} }

View File

@@ -307,19 +307,11 @@ public final class RepositoryServiceFactory
*/ */
public CacheClearHook(CacheManager cacheManager) public CacheClearHook(CacheManager cacheManager)
{ {
this.blameCache = this.blameCache = cacheManager.getCache(BlameCommandBuilder.CACHE_NAME);
cacheManager.getCache(BlameCommandBuilder.CacheKey.class, this.browseCache = cacheManager.getCache(BrowseCommandBuilder.CACHE_NAME);
BlameResult.class, BlameCommandBuilder.CACHE_NAME); this.logCache = cacheManager.getCache(LogCommandBuilder.CACHE_NAME);
this.browseCache = this.tagsCache = cacheManager.getCache(TagsCommandBuilder.CACHE_NAME);
cacheManager.getCache(BrowseCommandBuilder.CacheKey.class, this.branchesCache =cacheManager.getCache(BranchesCommandBuilder.CACHE_NAME);
BrowserResult.class, BrowseCommandBuilder.CACHE_NAME);
this.logCache = cacheManager.getCache(LogCommandBuilder.CacheKey.class,
ChangesetPagingResult.class, LogCommandBuilder.CACHE_NAME);
this.tagsCache = cacheManager.getCache(TagsCommandBuilder.CacheKey.class,
Tags.class, TagsCommandBuilder.CACHE_NAME);
this.branchesCache =
cacheManager.getCache(BranchesCommandBuilder.CacheKey.class,
Branches.class, BranchesCommandBuilder.CACHE_NAME);
} }
//~--- methods ------------------------------------------------------------ //~--- methods ------------------------------------------------------------

View File

@@ -30,6 +30,7 @@
*/ */
package sonia.scm.repository.api; package sonia.scm.repository.api;
//~--- non-JDK imports -------------------------------------------------------- //~--- non-JDK imports --------------------------------------------------------
@@ -94,7 +95,7 @@ public final class TagsCommandBuilder
TagsCommandBuilder(CacheManager cacheManager, TagsCommand command, TagsCommandBuilder(CacheManager cacheManager, TagsCommand command,
Repository repository) Repository repository)
{ {
this.cache = cacheManager.getCache(CacheKey.class, Tags.class, CACHE_NAME); this.cache = cacheManager.getCache(CACHE_NAME);
this.command = command; this.command = command;
this.repository = repository; this.repository = repository;
} }
@@ -112,7 +113,7 @@ public final class TagsCommandBuilder
*/ */
public Tags getTags() throws RepositoryException, IOException public Tags getTags() throws RepositoryException, IOException
{ {
Tags tags = null; Tags tags;
if (disableCache) if (disableCache)
{ {
@@ -270,22 +271,22 @@ public final class TagsCommandBuilder
//~--- fields ------------------------------------------------------------- //~--- fields -------------------------------------------------------------
/** Field description */ /** repository id */
private String repositoryId; private final String repositoryId;
} }
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** cache for changesets */ /** cache for changesets */
private Cache<CacheKey, Tags> cache; private final Cache<CacheKey, Tags> cache;
/** Field description */ /** command implementation */
private TagsCommand command; private final TagsCommand command;
/** Field description */ /** repository */
private final Repository repository;
/** disable cache */
private boolean disableCache = false; private boolean disableCache = false;
/** Field description */
private Repository repository;
} }

View File

@@ -91,7 +91,7 @@ public class HgPackageReader
public HgPackageReader(CacheManager cacheManager, public HgPackageReader(CacheManager cacheManager,
Provider<HttpClient> httpClientProvider) Provider<HttpClient> httpClientProvider)
{ {
cache = cacheManager.getCache(String.class, HgPackages.class, CACHENAME); cache = cacheManager.getCache(CACHENAME);
this.httpClientProvider = httpClientProvider; this.httpClientProvider = httpClientProvider;
} }
@@ -248,8 +248,8 @@ public class HgPackageReader
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** Field description */ /** Field description */
private Cache<String, HgPackages> cache; private final Cache<String, HgPackages> cache;
/** Field description */ /** Field description */
private Provider<HttpClient> httpClientProvider; private final Provider<HttpClient> httpClientProvider;
} }

View File

@@ -70,8 +70,6 @@ public class MapCacheManager implements CacheManager
* Method description * Method description
* *
* *
* @param key
* @param value
* @param name * @param name
* @param <K> * @param <K>
* @param <V> * @param <V>
@@ -79,103 +77,22 @@ public class MapCacheManager implements CacheManager
* @return * @return
*/ */
@Override @Override
public <K, V> Cache<K, V> getCache(Class<K> key, Class<V> value, String name) public <K, V> Cache<K, V> getCache(String name)
{ {
CacheKey cacheKey = new CacheKey(key, value, name); Cache<K, V> cache = cacheMap.get(name);
Cache<K, V> cache = cacheMap.get(cacheKey);
if (cache == null) if (cache == null)
{ {
cache = new MapCache<K, V>(); cache = new MapCache<K, V>();
cacheMap.put(cacheKey, cache); cacheMap.put(name, cache);
} }
return cache; return cache;
} }
//~--- inner classes --------------------------------------------------------
/**
* Class description
*
*
* @version Enter version here..., 12/06/24
* @author Enter your name here...
*/
private static class CacheKey
{
/**
* Constructs ...
*
*
* @param key
* @param value
* @param name
*/
public CacheKey(Class key, Class value, String name)
{
this.key = key;
this.value = value;
this.name = name;
}
//~--- methods ------------------------------------------------------------
/**
* Method description
*
*
* @param obj
*
* @return
*/
@Override
public boolean equals(Object obj)
{
if (obj == null)
{
return false;
}
if (getClass() != obj.getClass())
{
return false;
}
final CacheKey other = (CacheKey) obj;
return Objects.equal(key, other.key) && Objects.equal(value, other.value)
&& Objects.equal(name, other.name);
}
/**
* Method description
*
*
* @return
*/
@Override
public int hashCode()
{
return Objects.hashCode(key, value, name);
}
//~--- fields -------------------------------------------------------------
/** Field description */
private Class key;
/** Field description */
private String name;
/** Field description */
private Class value;
}
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** Field description */ /** Field description */
private Map<CacheKey, Cache> cacheMap = Maps.newHashMap(); private final Map<String, Cache> cacheMap = Maps.newHashMap();
} }

View File

@@ -36,6 +36,7 @@ package sonia.scm.api.rest.resources;
//~--- non-JDK imports -------------------------------------------------------- //~--- non-JDK imports --------------------------------------------------------
import com.github.legman.Subscribe; import com.github.legman.Subscribe;
import com.google.common.base.Function; import com.google.common.base.Function;
import com.google.inject.Inject; import com.google.inject.Inject;
import com.google.inject.Singleton; import com.google.inject.Singleton;
@@ -45,11 +46,13 @@ import org.codehaus.enunciate.modules.jersey.ExternallyManagedLifecycle;
import sonia.scm.cache.Cache; import sonia.scm.cache.Cache;
import sonia.scm.cache.CacheManager; import sonia.scm.cache.CacheManager;
import sonia.scm.group.Group; import sonia.scm.group.Group;
import sonia.scm.group.GroupEvent;
import sonia.scm.group.GroupManager; import sonia.scm.group.GroupManager;
import sonia.scm.search.SearchHandler; import sonia.scm.search.SearchHandler;
import sonia.scm.search.SearchResult; import sonia.scm.search.SearchResult;
import sonia.scm.search.SearchResults; import sonia.scm.search.SearchResults;
import sonia.scm.user.User; import sonia.scm.user.User;
import sonia.scm.user.UserEvent;
import sonia.scm.user.UserManager; import sonia.scm.user.UserManager;
//~--- JDK imports ------------------------------------------------------------ //~--- JDK imports ------------------------------------------------------------
@@ -59,8 +62,6 @@ import javax.ws.rs.Path;
import javax.ws.rs.Produces; import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam; import javax.ws.rs.QueryParam;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import sonia.scm.group.GroupEvent;
import sonia.scm.user.UserEvent;
/** /**
* *
@@ -94,14 +95,13 @@ public class SearchResource
{ {
// create user searchhandler // create user searchhandler
Cache<String, SearchResults> userCache = Cache<String, SearchResults> userCache = cacheManager.getCache(CACHE_USER);
cacheManager.getCache(String.class, SearchResults.class, CACHE_USER);
this.userSearchHandler = new SearchHandler<User>(userCache, userManager); this.userSearchHandler = new SearchHandler<User>(userCache, userManager);
// create group searchhandler // create group searchhandler
Cache<String, SearchResults> groupCache = Cache<String, SearchResults> groupCache =
cacheManager.getCache(String.class, SearchResults.class, CACHE_GROUP); cacheManager.getCache(CACHE_GROUP);
this.groupSearchHandler = new SearchHandler<Group>(groupCache, this.groupSearchHandler = new SearchHandler<Group>(groupCache,
groupManager); groupManager);
@@ -118,7 +118,8 @@ public class SearchResource
@Subscribe @Subscribe
public void onEvent(UserEvent event) public void onEvent(UserEvent event)
{ {
if ( event.getEventType().isPost() ){ if (event.getEventType().isPost())
{
userSearchHandler.clearCache(); userSearchHandler.clearCache();
} }
} }
@@ -132,7 +133,8 @@ public class SearchResource
@Subscribe @Subscribe
public void onEvent(GroupEvent event) public void onEvent(GroupEvent event)
{ {
if ( event.getEventType().isPost() ){ if (event.getEventType().isPost())
{
groupSearchHandler.clearCache(); groupSearchHandler.clearCache();
} }
} }

View File

@@ -118,8 +118,6 @@ public class GuavaCacheManager implements CacheManager
* Method description * Method description
* *
* *
* @param key
* @param value
* @param name * @param name
* @param <K> * @param <K>
* @param <V> * @param <V>
@@ -127,8 +125,7 @@ public class GuavaCacheManager implements CacheManager
* @return * @return
*/ */
@Override @Override
public synchronized <K, V> GuavaCache<K, V> getCache(Class<K> key, public synchronized <K, V> GuavaCache<K, V> getCache(String name)
Class<V> value, String name)
{ {
logger.trace("try to retrieve cache {}", name); logger.trace("try to retrieve cache {}", name);

View File

@@ -130,8 +130,7 @@ public class DefaultPluginManager implements PluginManager
{ {
this.context = context; this.context = context;
this.configuration = configuration; this.configuration = configuration;
this.cache = cacheManager.getCache(String.class, PluginCenter.class, this.cache = cacheManager.getCache(CACHE_NAME);
CACHE_NAME);
this.clientProvider = clientProvider; this.clientProvider = clientProvider;
installedPlugins = new HashMap<String, Plugin>(); installedPlugins = new HashMap<String, Plugin>();

View File

@@ -106,8 +106,7 @@ public class AuthorizationCollector
RepositoryDAO repositoryDAO, SecuritySystem securitySystem, RepositoryDAO repositoryDAO, SecuritySystem securitySystem,
PermissionResolver resolver) PermissionResolver resolver)
{ {
this.cache = cacheManager.getCache(CacheKey.class, AuthorizationInfo.class, this.cache = cacheManager.getCache(CACHE_NAME);
CACHE_NAME);
this.repositoryDAO = repositoryDAO; this.repositoryDAO = repositoryDAO;
this.securitySystem = securitySystem; this.securitySystem = securitySystem;
this.resolver = resolver; this.resolver = resolver;
@@ -524,15 +523,15 @@ public class AuthorizationCollector
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** Field description */ /** authorization cache */
private Cache<CacheKey, AuthorizationInfo> cache; private final Cache<CacheKey, AuthorizationInfo> cache;
/** Field description */ /** repository dao */
private RepositoryDAO repositoryDAO; private final RepositoryDAO repositoryDAO;
/** Field description */ /** permission resolver */
private PermissionResolver resolver; private final PermissionResolver resolver;
/** Field description */ /** security system */
private SecuritySystem securitySystem; private final SecuritySystem securitySystem;
} }

View File

@@ -100,8 +100,7 @@ public class ChainAuthenticatonManager extends AbstractAuthenticationManager
AssertUtil.assertIsNotNull(cacheManager); AssertUtil.assertIsNotNull(cacheManager);
this.authenticationHandlers = sort(userManager, authenticationHandlerSet); this.authenticationHandlers = sort(userManager, authenticationHandlerSet);
this.encryptionHandler = encryptionHandler; this.encryptionHandler = encryptionHandler;
this.cache = cacheManager.getCache(String.class, this.cache = cacheManager.getCache(CACHE_NAME);
AuthenticationCacheValue.class, CACHE_NAME);
} }
//~--- methods -------------------------------------------------------------- //~--- methods --------------------------------------------------------------
@@ -368,12 +367,12 @@ public class ChainAuthenticatonManager extends AbstractAuthenticationManager
//~--- fields --------------------------------------------------------------- //~--- fields ---------------------------------------------------------------
/** Field description */ /** authentication handlers */
private List<AuthenticationHandler> authenticationHandlers; private final List<AuthenticationHandler> authenticationHandlers;
/** Field description */ /** authentication cache */
private Cache<String, AuthenticationCacheValue> cache; private final Cache<String, AuthenticationCacheValue> cache;
/** Field description */ /** encryption handler */
private EncryptionHandler encryptionHandler; private final EncryptionHandler encryptionHandler;
} }

View File

@@ -89,10 +89,8 @@ public abstract class CacheManagerTestBase<C extends Cache>
@Test @Test
public void testSameReference() public void testSameReference()
{ {
Cache<String, String> c1 = cacheManager.getCache(String.class, Cache<String, String> c1 = cacheManager.getCache("test-1");
String.class, "test-1"); Cache<String, String> c2 = cacheManager.getCache("test-1");
Cache<String, String> c2 = cacheManager.getCache(String.class,
String.class, "test-1");
assertIsSame(c1, c2); assertIsSame(c1, c2);
} }
@@ -203,16 +201,16 @@ public abstract class CacheManagerTestBase<C extends Cache>
@Override @Override
public Cache call() throws Exception public Cache call() throws Exception
{ {
return cacheManager.getCache(String.class, String.class, name); return cacheManager.getCache(name);
} }
//~--- fields ------------------------------------------------------------- //~--- fields -------------------------------------------------------------
/** Field description */ /** Field description */
private CacheManager cacheManager; private final CacheManager cacheManager;
/** Field description */ /** Field description */
private String name; private final String name;
} }

View File

@@ -76,7 +76,7 @@ public abstract class CacheTestBase
public void before() public void before()
{ {
cm = createCacheManager(); cm = createCacheManager();
cache = cm.getCache(String.class, String.class, "test"); cache = cm.getCache("test");
} }
/** /**