method2testcases
stringlengths
118
6.63k
### Question: CopyStrategyHandler { public Element copyElementForReadIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForRead(element); } else if (copyOnRead) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return ...
### Question: CopyStrategyHandler { Element copyElementForWriteIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else if (copyOnWrite) { return copyStrategy.copyForRead(copyStrategy.copyForWrite(element)); } else { return elem...
### Question: CopyStrategyHandler { Element copyElementForRemovalIfNeeded(Element element) { if (element == null) { return null; } if (copyOnRead && copyOnWrite) { return copyStrategy.copyForWrite(element); } else { return element; } } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<E...
### Question: Element implements Serializable, Cloneable { @Override public final boolean equals(final Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element...
### Question: Element implements Serializable, Cloneable { public final long getCreationTime() { return creationTime; } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Deprecated Element(final Object key, final Object v...
### Question: Element implements Serializable, Cloneable { public final long getLatestOfCreationAndUpdateTime() { if (0 == lastUpdateTime) { return creationTime; } else { return lastUpdateTime; } } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object val...
### Question: Element implements Serializable, Cloneable { public long getExpirationTime() { if (!isLifespanSet() || isEternal()) { return Long.MAX_VALUE; } long expirationTime = 0; long ttlExpiry = creationTime + TimeUtil.toMillis(getTimeToLive()); long mostRecentTime = Math.max(creationTime, lastAccessTime); long tti...
### Question: Element implements Serializable, Cloneable { public boolean isEternal() { return (0 == timeToIdle) && (0 == timeToLive); } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Deprecated Element(final Object ke...
### Question: Element implements Serializable, Cloneable { boolean hasId() { return id != NOT_SET_ID; } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long version); @Deprecated Element(final Object key, final Object value, final long...
### Question: MValue implements ModelElement<T> { public T asJavaObject() { return javaObject; } MValue(Token tok, String typeName, Message errMessage, String value); T asJavaObject(); T asEhcacheObject(); @Override String toString(); String getTypeName(); String getValue(); @Override int hashCode(); @Override boolean ...
### Question: Element implements Serializable, Cloneable { void setId(final long id) { if (id == NOT_SET_ID) { throw new IllegalArgumentException("Id cannot be set to " + id); } this.id = id; } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, ...
### Question: QueryManagerBuilder { public static QueryManagerBuilder newQueryManagerBuilder() { return new QueryManagerBuilder(); } private QueryManagerBuilder(); QueryManagerBuilder(Class<? extends QueryManager> implementationClass); static QueryManagerBuilder newQueryManagerBuilder(); QueryManagerBuilder addCache...
### Question: PayloadUtil { public static byte[] gzip(byte[] ungzipped) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream(); try { final GZIPOutputStream gzipOutputStream = new GZIPOutputStream(bytes); gzipOutputStream.write(ungzipped); gzipOutputStream.close(); } catch (IOException e) { LOG.error("Could ...
### Question: PayloadUtil { public static List<byte[]> createCompressedPayloadList(final List<CachePeer> localCachePeers, final int maximumPeersPerSend) { List<byte[]> rv = new ArrayList<byte[]>(); int iters = (int) Math.ceil((double) localCachePeers.size() / maximumPeersPerSend); for (int i = 0; i < iters; i++) { int ...
### Question: EventMessage implements Serializable { public final Serializable getSerializableKey() { return key; } EventMessage(Ehcache cache, Serializable key); final Ehcache getEhcache(); final Serializable getSerializableKey(); }### Answer: @Test public void testSerialization() throws IOException, ClassNotFoundExc...
### Question: RegisteredEventListeners { public final boolean registerListener(CacheEventListener cacheEventListener) { return registerListener(cacheEventListener, NotificationScope.ALL); } RegisteredEventListeners(Cache cache); RegisteredEventListeners(Ehcache cache, CacheStoreHelper helper); final void notifyElement...
### Question: MValue implements ModelElement<T> { public T asEhcacheObject(ClassLoader loader) { return javaObject; } MValue(Token tok, String typeName, Message errMessage, String value); T asEhcacheObject(ClassLoader loader); @Override String toString(); String getTypeName(); String getValue(); @Override int hashCode(...
### Question: ClusteredInstanceFactoryAccessor { public static ClusteredInstanceFactory getClusteredInstanceFactory(CacheManager cacheManager) { try { Field field = CacheManager.class.getDeclaredField("terracottaClient"); field.setAccessible(true); TerracottaClient terracottaClient = (TerracottaClient)field.get(cacheMa...
### Question: DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService, DfltSamplerRepositoryServiceMBean { @Override public Collection<CacheStatisticSampleEntity> createCacheStatisticSampleEntity...
### Question: DfltSamplerRepositoryService extends AbstractRemoteAgentEndpointImpl implements SamplerRepositoryService, EntityResourceFactory, CacheManagerService, CacheService, AgentService, DfltSamplerRepositoryServiceMBean { @Override public void clearCache(String cacheManagerName, String cacheName) { cacheManag...
### Question: ApplicationEhCache extends DefaultApplication { public Set<Class<?>> getClasses() { Set<Class<?>> s = new HashSet<Class<?>>(super.getClasses()); s.add(net.sf.ehcache.management.resource.services.ElementsResourceServiceImpl.class); s.add(net.sf.ehcache.management.resource.services.CacheStatisticSamplesReso...
### Question: ClusteredStore implements TerracottaStore, StoreListener { @Override public Element putIfAbsent(Element element) throws NullPointerException { if (isEventual && !EVENTUAL_CAS_ENABLED) { throw new UnsupportedOperationException("CAS operations are not supported in eventual consistency mode, consider using a...
### Question: ClusteredStore implements TerracottaStore, StoreListener { @Override public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { if (isEventual) { return removeElementEventual(element, comparator); } String pKey = generatePortableKeyFor(element.getKey());...
### Question: AsyncWriteBehind implements WriteBehind { @Override public void start(CacheWriter writer) throws CacheException { async.start(new CacheWriterProcessor(writer), concurrency, POLICY); } AsyncWriteBehind(final AsyncCoordinator async, final int writeBehindConcurrency); @Override void start(CacheWriter writer)...
### Question: DfltSamplerRepositoryService implements ManagementServerLifecycle, EntityResourceFactory, CacheManagerService, CacheService, AgentService { @Override public void clearCache(String cacheManagerName, String cacheName) { cacheManagerSamplerRepoLock.readLock().lock(); SamplerRepoEntry entry = cacheManager...
### Question: TerracottaBootstrapCacheLoader extends MemoryLimitedCacheLoader implements Disposable { public void load(final Ehcache cache) throws CacheException { if (!cache.getCacheConfiguration().isTerracottaClustered()) { LOG.error("You're trying to bootstrap a non Terracotta clustered cache with a TerracottaBootst...
### Question: BlockingCache extends EhcacheDecoratorAdapter { @Override public Element getWithLoader(Object key, CacheLoader loader, Object loaderArgument) throws CacheException { throw new CacheException("This method is not appropriate for a Blocking Cache"); } BlockingCache(final Ehcache cache, int numberOfStripes); ...
### Question: LruMemoryStore extends AbstractStore { public final boolean containsKey(Object key) { return map.containsKey(key); } LruMemoryStore(Ehcache cache, Store diskStore); synchronized void unpinAll(); synchronized boolean isPinned(Object key); synchronized void setPinned(Object key, boolean pinned); final boole...
### Question: CacheManager { public static CacheManager create() throws CacheException { if (singleton != null) { LOG.debug("Attempting to create an existing singleton. Existing singleton returned."); return singleton; } synchronized (CacheManager.class) { if (singleton == null) { singleton = newInstance(); } else { LO...
### Question: CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); Ehcache ehcache = ehcaches.get(name); return ehcache instanceof Cache ? (Cache) ehcache : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); Cac...
### Question: CacheManager { public synchronized void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(...
### Question: CacheManager { public synchronized void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName ...
### Question: CacheManager { public synchronized Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputS...
### Question: AsyncWriteBehind implements WriteBehind { @Override public void delete(CacheEntry entry) { async.add(new DeleteAsyncOperation(entry.getKey(), entry.getElement())); } AsyncWriteBehind(final AsyncCoordinator async, final int writeBehindConcurrency); @Override void start(CacheWriter writer); @Override void w...
### Question: AsyncWriteBehind implements WriteBehind { @Override public void write(Element element) { async.add(new WriteAsyncOperation(element)); } AsyncWriteBehind(final AsyncCoordinator async, final int writeBehindConcurrency); @Override void start(CacheWriter writer); @Override void write(Element element); @Overri...
### Question: CacheWriterConfiguration implements Cloneable { public CacheWriterConfiguration writeMode(String writeMode) { setWriteMode(writeMode); return this; } @Override CacheWriterConfiguration clone(); void setWriteMode(String writeMode); CacheWriterConfiguration writeMode(String writeMode); CacheWriterConfigura...
### Question: ConfigurationFactory { static Set extractPropertyTokens(String sourceDocument) { Set propertyTokens = new HashSet(); Pattern pattern = Pattern.compile("\\$\\{.+?\\}"); Matcher matcher = pattern.matcher(sourceDocument); while (matcher.find()) { String token = matcher.group(); propertyTokens.add(token); } r...
### Question: SelfPopulatingCache extends BlockingCache { protected void refreshElement(final Element element, Ehcache backingCache) throws Exception { refreshElement(element, backingCache, true); } SelfPopulatingCache(final Ehcache cache, final CacheEntryFactory factory); @Override Element get(final Object key); void ...
### Question: XATransactionalStore extends AbstractStore { public Element removeElement(Element element) throws NullPointerException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); if (previous != null && previous.getValue().equals(element...
### Question: CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { LOG.debug("CacheManager already shutdown"); return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { if (cacheManagerPeerProvider != null...
### Question: CacheManager { public static CacheManager create() throws CacheException { if (singleton != null) { return singleton; } synchronized (CacheManager.class) { if (singleton == null) { LOG.debug("Creating new CacheManager with default config"); singleton = new CacheManager(); } else { LOG.debug("Attempting to...
### Question: CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL co...
### Question: CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); configurat...
### Question: CacheManager { public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configu...
### Question: AsyncWriteBehind implements WriteBehind { @Override public void stop() throws CacheException { async.stop(); } AsyncWriteBehind(final AsyncCoordinator async, final int writeBehindConcurrency); @Override void start(CacheWriter writer); @Override void write(Element element); @Override void delete(CacheEntry...
### Question: AsyncWriteBehind implements WriteBehind { @Override public long getQueueSize() { return async.getQueueSize(); } AsyncWriteBehind(final AsyncCoordinator async, final int writeBehindConcurrency); @Override void start(CacheWriter writer); @Override void write(Element element); @Override void delete(CacheEntr...
### Question: CacheManager { public static CacheManager create() throws CacheException { if (singleton != null) { LOG.debug("Attempting to create an existing singleton. Existing singleton returned."); return singleton; } synchronized (CacheManager.class) { if (singleton == null) { singleton = newInstance(); } else { LO...
### Question: CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); Ehcache ehcache = ehcaches.get(name); return ehcache instanceof Cache ? (Cache) ehcache : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); Cac...
### Question: CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); runtimeCfg...
### Question: CacheManager { public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already e...
### Question: CacheManager { public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configu...
### Question: ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catch (ClassNotFoundException e) { c = super.loadClass(name, resolve); } }...
### Question: UpdateChecker extends TimerTask { public void checkForUpdate() { try { if (!Boolean.getBoolean("net.sf.ehcache.skipUpdateCheck")) { doCheck(); } } catch (Throwable t) { LOG.debug("Update check failed: ", t); } } @Override void run(); void checkForUpdate(); }### Answer: @Test public void testErrorNotBubl...
### Question: AsyncWriteBehind implements WriteBehind { @Override public void setOperationsFilter(OperationsFilter filter) { OperationsFilterWrapper filterWrapper = new OperationsFilterWrapper(filter); async.setOperationsFilter(filterWrapper); } AsyncWriteBehind(final AsyncCoordinator async, final int writeBehindConcur...
### Question: SelectableConcurrentHashMap { public Element get(Object key) { int hash = hash(key.hashCode()); return segmentFor(hash).get(key, hash); } SelectableConcurrentHashMap(PoolAccessor poolAccessor, boolean elementPinningEnabled, int concurrency, final long maximumSize, final RegisteredEventListeners cacheEvent...
### Question: CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL co...
### Question: CacheManager { public synchronized void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(...
### Question: CacheManager { public synchronized void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName ...
### Question: CacheManager { public synchronized Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputS...
### Question: Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null) && elementEvictionData.canParticipateInSerialization(); } Element(final Serializable key, final Serializable value, final long version); Elem...
### Question: Element implements Serializable, Cloneable { @Override public final boolean equals(final Object object) { if (object == null || !(object instanceof Element)) { return false; } Element element = (Element) object; if (key == null || element.getObjectKey() == null) { return false; } return key.equals(element...
### Question: Watchdog { public void watch(final Watchable watchable) { registry.add(watchable); LOGGER.debug("Watchable cache '{}' registered", watchable.name()); } private Watchdog(final ScheduledExecutorService scheduler); static Watchdog create(); void watch(final Watchable watchable); void unwatch(final Watchable...
### Question: ScheduledRefreshCacheExtension implements CacheExtension { static Collection<ScheduledRefreshCacheExtension> findExtensionsFromCache(Ehcache cache) { LinkedList<ScheduledRefreshCacheExtension> exts=new LinkedList<ScheduledRefreshCacheExtension>(); for (CacheExtension ce : cache.getRegisteredCacheExtension...
### Question: CacheManager { public static CacheManager create() throws CacheException { return create(ConfigurationFactory.parseConfiguration(), "Creating new CacheManager with default config"); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL...
### Question: CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return ehcaches.get(name) instanceof Cache ? (Cache) ehcaches.get(name) : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL co...
### Question: CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); runtimeCfg...
### Question: CacheManager { public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName + " already e...
### Question: CacheManager { public Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream configu...
### Question: ResourceClassLoader extends ClassLoader { @Override public synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException { if (name.startsWith("java.")) { return getParent().loadClass(name); } Class c = findLoadedClass(name); if (c == null) { try { c = findClass(name); } catc...
### Question: OnHeapCachingTier implements CachingTier<K, V> { @Override public V get(final K key, final Callable<V> source, final boolean updateStats) { if (updateStats) { getObserver.begin(); } Object cachedValue = backEnd.get(key); if (cachedValue == null) { if (updateStats) { getObserver.end(GetOutcome.MISS); } Fau...
### Question: DfltSamplerRepositoryService implements ManagementServerLifecycle, EntityResourceFactory, CacheManagerService, CacheService, AgentService { @Override public Collection<CacheEntity> createCacheEntities(Set<String> cacheManagerNames, Set<String> cacheNames, Set<String> attributes) { CacheEntityBuilder b...
### Question: ManagementService implements CacheManagerEventListener { public void init() throws CacheException { CacheManager cacheManager = new CacheManager(backingCacheManager); try { registerCacheManager(cacheManager); registerPeerProviders(); List caches = cacheManager.getCaches(); for (int i = 0; i < caches.size(...
### Question: ElementResource { @DELETE public void deleteElement() throws WebApplicationException { LOG.debug("DELETE element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); if (element.equals("*")) { ehcache.removeAll(); } else { boolean removed = ehcache.remove(element); if (!removed) { throw new WebApp...
### Question: ElementResource { @GET public Response getElement() { LOG.debug("GET element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); net.sf.ehcache.Element ehcacheElement = lookupElement(ehcache); Element localElement = new Element(ehcacheElement, uriInfo.getAbsolutePath().toString()); Date lastModif...
### Question: CacheResource { @GET public Cache getCache() { LOG.debug("GET Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); if (ehcache == null) { throw new WebApplicationException(Response.Status.NOT_FOUND); } String cacheAsString = ehcache.toString(); cacheAsString = cacheAsString.substrin...
### Question: CacheResource { @DELETE public Response deleteCache() { LOG.debug("DELETE Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); Response response; if (ehcache == null) { throw new WebApplicationException(Response.Status.NOT_FOUND); } else { CacheManager.getInstance().removeCache(cach...
### Question: CachesResource { @GET public List<Cache> getCaches() { LOG.debug("GET Caches"); String[] cacheNames = MANAGER.getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { Ehcache ehcache = MANAGER.getCache(cacheName); URI cacheUri = uriInfo.getAbsolutePathBuilder(...
### Question: EhcacheWebServiceEndpoint { @WebMethod public String ping() { return "pong"; } @WebMethod String ping(); @WebMethod Cache getCache(String cacheName); @WebMethod void addCache(String cacheName); @WebMethod void removeCache(String cacheName); @WebMethod String[] cacheNames(); @WebMethod Status getStatus(St...
### Question: EhcacheWebServiceEndpoint { @WebMethod public Cache getCache(String cacheName) throws CacheException { Ehcache ehcache = manager.getCache(cacheName); if (ehcache != null) { return new Cache(ehcache); } else { return null; } } @WebMethod String ping(); @WebMethod Cache getCache(String cacheName); @WebMeth...
### Question: EhcacheWebServiceEndpoint { @WebMethod public void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { manager.addCache(cacheName); } @WebMethod String ping(); @WebMethod Cache getCache(String cacheName); @WebMethod void addCache(String cacheName); @WebMethod ...
### Question: EhcacheWebServiceEndpoint { @WebMethod public void removeCache(String cacheName) throws IllegalStateException { manager.removeCache(cacheName); } @WebMethod String ping(); @WebMethod Cache getCache(String cacheName); @WebMethod void addCache(String cacheName); @WebMethod void removeCache(String cacheName...
### Question: EhcacheWebServiceEndpoint { @WebMethod public String[] cacheNames() throws IllegalStateException { return manager.getCacheNames(); } @WebMethod String ping(); @WebMethod Cache getCache(String cacheName); @WebMethod void addCache(String cacheName); @WebMethod void removeCache(String cacheName); @WebMethod...
### Question: EhcacheWebServiceEndpoint { @WebMethod public Status getStatus(String cacheName) { net.sf.ehcache.Cache cache = lookupCache(cacheName); return Status.fromCode(cache.getStatus().intValue()); } @WebMethod String ping(); @WebMethod Cache getCache(String cacheName); @WebMethod void addCache(String cacheName)...
### Question: EhcacheWebServiceEndpoint { @WebMethod public void put(String cacheName, Element element) throws NoSuchCacheException, CacheException { net.sf.ehcache.Cache cache = lookupCache(cacheName); cache.put(element.getEhcacheElement()); } @WebMethod String ping(); @WebMethod Cache getCache(String cacheName); @We...
### Question: EhcacheWebServiceEndpoint { @WebMethod public List getKeys(String cacheName) throws IllegalStateException, CacheException { net.sf.ehcache.Cache cache = lookupCache(cacheName); return cache.getKeys(); } @WebMethod String ping(); @WebMethod Cache getCache(String cacheName); @WebMethod void addCache(String...
### Question: EhcacheWebServiceEndpoint { @WebMethod public boolean remove(String cacheName, String key) throws CacheException { net.sf.ehcache.Cache cache = lookupCache(cacheName); return cache.remove(key); } @WebMethod String ping(); @WebMethod Cache getCache(String cacheName); @WebMethod void addCache(String cacheN...
### Question: EhcacheWebServiceEndpoint { @WebMethod public Statistics getStatistics(String cacheName) throws IllegalStateException { net.sf.ehcache.Cache cache = lookupCache(cacheName); return new Statistics(cache.getStatistics()); } @WebMethod String ping(); @WebMethod Cache getCache(String cacheName); @WebMethod vo...
### Question: EhcacheWebServiceEndpoint { @WebMethod public void load(String cacheName, String key) throws CacheException { net.sf.ehcache.Cache cache = lookupCache(cacheName); cache.load(key); } @WebMethod String ping(); @WebMethod Cache getCache(String cacheName); @WebMethod void addCache(String cacheName); @WebMeth...
### Question: EhcacheWebServiceEndpoint { @WebMethod public void loadAll(String cacheName, Collection<String> keys) throws CacheException { net.sf.ehcache.Cache cache = lookupCache(cacheName); cache.loadAll(keys, null); } @WebMethod String ping(); @WebMethod Cache getCache(String cacheName); @WebMethod void addCache(S...
### Question: EhcacheWebServiceEndpoint { @WebMethod public Element getWithLoader(String cacheName, String key) { net.sf.ehcache.Cache cache = lookupCache(cacheName); net.sf.ehcache.Element element = cache.getWithLoader(key, null, null); if (element != null) { return new Element(element); } else { return null; } } @We...
### Question: EhcacheWebServiceEndpoint { @WebMethod public HashMap getAllWithLoader(String cacheName, Collection keys) throws CacheException { net.sf.ehcache.Cache cache = lookupCache(cacheName); return (HashMap) cache.getAllWithLoader(keys, null); } @WebMethod String ping(); @WebMethod Cache getCache(String cacheNam...
### Question: CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); Ehcache ehcache = ehcaches.get(name); return ehcache instanceof Cache ? (Cache) ehcache : null; } CacheManager(Configuration configuration); CacheManager(String configurationFileName); Cac...
### Question: CacheManager { public synchronized void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(...
### Question: CacheManager { public synchronized void addCache(String cacheName) throws IllegalStateException, ObjectExistsException, CacheException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } if (ehcaches.get(cacheName) != null) { throw new ObjectExistsException("Cache " + cacheName ...
### Question: CacheManager { public synchronized Ehcache addCacheIfAbsent(final Ehcache cache) { checkStatus(); return cache == null ? null : addCacheNoCheck(cache, false); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputS...
### Question: SizeOf { public SizeOf(SizeOfFilter fieldFilter, boolean caching) { ObjectGraphWalker.Visitor visitor; if (caching) { visitor = new CachingSizeOfVisitor(); } else { visitor = new SizeOfVisitor(); } this.walker = new ObjectGraphWalker(visitor, fieldFilter); } SizeOf(SizeOfFilter fieldFilter, boolean cachin...
### Question: SizeOf { public Size deepSizeOf(int maxDepth, boolean abortWhenMaxDepthExceeded, Object... obj) { try { return new Size(walker.walk(maxDepth, abortWhenMaxDepthExceeded, obj), true); } catch (MaxDepthExceededException e) { LOG.warn(e.getMessage()); return new Size(e.getMeasuredSize(), false); } } SizeOf(Si...
### Question: ManagementService implements CacheManagerEventListener { private void registerCacheManager(CacheManager cacheManager) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException { if (registerCacheManager) { mBeanServer.registerMBean(cacheManager, cacheManager.getObjectNa...
### Question: SelfPopulatingCache extends BlockingCache { public Element get(final Object key) throws LockTimeoutException { try { Element element = super.get(key); if (element == null) { Object value = factory.createEntry(key); element = makeAndCheckElement(key, value); put(element); } return element; } catch (LockTim...
### Question: SelfPopulatingCache extends BlockingCache { public void refresh() throws CacheException { refresh(true); } SelfPopulatingCache(final Ehcache cache, final CacheEntryFactory factory); Element get(final Object key); void refresh(); void refresh(boolean quiet); Element refresh(Object key); Element refresh(Obj...