method2testcases stringlengths 118 6.63k |
|---|
### Question:
ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int has... |
### Question:
BlockingCache implements Ehcache { protected Ehcache getCache() { return cache; } BlockingCache(final Ehcache cache, int numberOfStripes); BlockingCache(final Ehcache cache); String getName(); void setName(String name); boolean isExpired(Element element); @Override Object clone(); RegisteredEventListener... |
### Question:
BlockingCache implements Ehcache { 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); BlockingCache(final Eh... |
### Question:
ExplicitLockingCache implements Ehcache { public boolean putIfAbsent(Element element) { try { acquireWriteLockOnKey(element.getKey()); if (!isKeyInCache(element.getKey())) { this.put(element); return true; } return false; } finally { releaseWriteLockOnKey(element.getKey()); } } ExplicitLockingCache(Ehcach... |
### Question:
SizeOfEngineLoader implements SizeOfEngineFactory { @Override public SizeOfEngine createSizeOfEngine(final int maxObjectCount, final boolean abort, final boolean silent) { SizeOfEngineFactory currentFactory = this.factory; if (currentFactory != null) { return currentFactory.createSizeOfEngine(maxObjectCou... |
### Question:
AnnotationProxyFactory { public static <T extends Annotation> T getAnnotationProxy(Annotation customAnnotation, Class<T> referenceAnnotation) { InvocationHandler handler = new AnnotationInvocationHandler(customAnnotation); return (T) Proxy.newProxyInstance(referenceAnnotation.getClassLoader(), new Class[]... |
### 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:
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:
XATransactionalStore extends AbstractStore { public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); if (previous != null &&... |
### 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 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:
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:
SelfPopulatingCache extends BlockingCache { public void refresh() throws CacheException { refresh(true); } SelfPopulatingCache(final Ehcache cache, final CacheEntryFactory factory); @Override Element get(final Object key); void refresh(); void refresh(boolean quiet); Element refresh(Object key); Element r... |
### 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:
ManagementService implements CacheManagerEventListener { public void init() throws CacheException { CacheManager cacheManager = new CacheManager(backingCacheManager); try { registerCacheManager(cacheManager); List caches = cacheManager.getCaches(); for (int i = 0; i < caches.size(); i++) { Cache cache = (... |
### 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 void refresh() throws CacheException { Exception exception = null; Object keyWithException = null; final Collection keys = getKeys(); if (LOG.isLoggable(Level.FINE)) { LOG.fine(getName() + ": found " + keys.size() + " keys to refresh"); } for (Iterator it... |
### Question:
UpdatingSelfPopulatingCache extends SelfPopulatingCache { public Element get(final Object key) throws LockTimeoutException { try { Ehcache backingCache = getCache(); Element element = backingCache.get(key); if (element == null) { element = super.get(key); } else { Mutex lock = stripedMutex.getMutexForKey(... |
### Question:
ClusteredStore implements TerracottaStore, StoreListener { @Override public void dispose() { dropLeaderStatus(); topology.removeTopologyListener(eventListenersRefresher); backend.removeListener(evictionListener); backend.disposeLocally(); cacheConfigChangeBridge.disconnectConfigs(); toolkitInstanceFactory... |
### Question:
DfltSamplerRepositoryService implements ManagementServerLifecycle,
EntityResourceFactory, CacheManagerService, CacheService, AgentService { @Override public Collection<CacheStatisticSampleEntity> createCacheStatisticSampleEntity(Set<String> cacheManagerNames, Set<String> cacheNames, Set<String> sample... |
### Question:
BlockingCache implements Ehcache { protected Ehcache getCache() { return cache; } BlockingCache(final Ehcache cache); String getName(); void setName(String name); boolean isExpired(Element element); Object clone(); RegisteredEventListeners getCacheEventNotificationService(); boolean isElementInMemory(Seri... |
### Question:
BlockingCache implements Ehcache { 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); String getName(); void setName(String name);... |
### Question:
CachesResource { @GET public Caches getCaches() { LOG.info("GET Caches"); String[] cacheNames = CacheManager.getInstance().getCacheNames(); List<Cache> cacheList = new ArrayList<Cache>(); for (String cacheName : cacheNames) { URI cacheUri = uriInfo.getAbsolutePathBuilder().path(cacheName).build().normaliz... |
### 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 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 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 clearStatistics(String cacheName) { net.sf.ehcache.Cache cache = lookupCache(cacheName); cache.clearStatistics(); } @WebMethod String ping(); @WebMethod Cache getCache(String cacheName); @WebMethod void addCache(String cacheName); @WebMethod void removeC... |
### Question:
EhcacheWebServiceEndpoint { @WebMethod public Element getWithLoader(String cacheName, String key) throws NoSuchCacheException { net.sf.ehcache.Cache cache = lookupCache(cacheName); net.sf.ehcache.Element element = cache.getWithLoader(key, null, null); if (element != null) { return new Element(element); } ... |
### Question:
ConcurrencyUtil { public static int selectLock(final Object key, int numberOfLocks) throws CacheException { int number = numberOfLocks & (numberOfLocks - 1); if (number != 0) { throw new CacheException("Lock number must be a power of two: " + numberOfLocks); } if (key == null) { return 0; } else { int has... |
### Question:
Status implements Serializable { public boolean equals(Object object) { if (!(object instanceof Status)) { return false; } return ((Status) object).intValue == intValue; } private Status(int intValue, String name); String toString(); static Status convertIntToStatus(int statusAsInt); int intValue(); bool... |
### Question:
CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "CacheManager already shutdown"); } return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.va... |
### Question:
CacheManager { public static CacheManager create() throws CacheException { if (singleton != null) { return singleton; } synchronized (CacheManager.class) { if (singleton == null) { if (LOG.isLoggable(Level.FINE)) { LOG.log(Level.FINE, "Creating new CacheManager with default config"); } singleton = new Cac... |
### Question:
CacheManager { public Cache getCache(String name) throws IllegalStateException, ClassCastException { checkStatus(); return (Cache) caches.get(name); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream conf... |
### Question:
CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = (Ehcache) ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); ... |
### 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:
Statistics implements Serializable { public void clearStatistics() { if (cache == null) { throw new IllegalStateException("This statistics object no longer references a Cache."); } cache.clearStatistics(); } Statistics(Ehcache cache, int statisticsAccuracy, long cacheHits, long onDiskHits, long inMemoryHi... |
### Question:
Element implements Serializable, Cloneable { public final long getSerializedSize() { if (!isSerializable()) { return 0; } long size = 0; ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(bout); oos.writeObject(this); size = bout.siz... |
### Question:
Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } Element(Serializable key, Serializable value, long version); Element(Object key, Object value, long version); Element(Object key, Object ... |
### Question:
Element implements Serializable, Cloneable { public final boolean equals(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.getObjectKey())... |
### Question:
OnHeapCachingTier implements CachingTier<K, V> { @Override public V get(final K key, final Callable<V> source, final boolean updateStats) { Object cachedValue = backEnd.get(key); if (cachedValue == null) { Fault<V> f = new Fault<V>(source); cachedValue = backEnd.putIfAbsent(key, f); if (cachedValue == nul... |
### 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.log(Level.SEV... |
### Question:
JCache implements net.sf.jsr107cache.Cache { public void evict() { cache.evictExpiredElements(); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCacheLoader(JCacheLoader cacheLoader); void addListener(Ca... |
### Question:
JCache implements net.sf.jsr107cache.Cache { public boolean containsValue(Object value) { long start = System.currentTimeMillis(); boolean inCache = cache.isValueInCache(value); long end = System.currentTimeMillis(); if (LOG.isLoggable(Level.WARNING)) { LOG.warning("Performance Warning: containsValue is n... |
### Question:
JCache implements net.sf.jsr107cache.Cache { public void loadAll(final Collection keys) throws CacheException { loadAll(keys, null); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCacheLoader(JCacheLoad... |
### Question:
JCacheEntry implements CacheEntry { public boolean isValid() { if (element != null) { return !element.isExpired(); } else { return false; } } JCacheEntry(Element element); Object getKey(); Object getValue(); Object setValue(Object value); long getCost(); long getCreationTime(); long getExpirationTime(); i... |
### Question:
SlewClock { static long timeMillis() { boolean interrupted = false; try { while (true) { long mono = CURRENT.get(); long wall = getCurrentTime(); if (wall == mono) { OFFSET.remove(); return wall; } else if (wall >= mono) { if (CURRENT.compareAndSet(mono, wall)) { OFFSET.remove(); return wall; } } else { l... |
### Question:
XATransactionalStore extends AbstractStore { public Element removeElement(Element element, ElementValueComparator comparator) throws NullPointerException { TransactionContext context = getOrCreateTransactionContext(); Element previous = getCurrentElement(element.getKey(), context); if (previous != null &&... |
### 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 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(); cacheManag... |
### Question:
BlockingCache implements Ehcache { protected Ehcache getCache() { return cache; } BlockingCache(final Ehcache cache, int numberOfStripes); BlockingCache(final Ehcache cache); String getName(); void setName(String name); boolean isExpired(Element element); @Override Object clone(); RegisteredEventListener... |
### Question:
BlockingCache implements Ehcache { 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); BlockingCache(final Eh... |
### 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 (Cache) caches.get(name); } CacheManager(Configuration configuration); CacheManager(String configurationFileName); CacheManager(URL configurationURL); CacheManager(InputStream conf... |
### Question:
CacheManager { public void removeCache(String cacheName) throws IllegalStateException { checkStatus(); if (cacheName == null || cacheName.length() == 0) { return; } Ehcache cache = (Ehcache) ehcaches.remove(cacheName); if (cache != null && cache.getStatus().equals(Status.STATUS_ALIVE)) { cache.dispose(); ... |
### 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:
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:
CountBasedBackEnd extends ConcurrentHashMap<K, V> implements HeapCacheBackEnd<K, V> { @Override public V putIfAbsent(final K key, final V value) { final V v = super.putIfAbsent(key, value); if (v == null) { try { evictIfRequired(key, value); } catch (Throwable e) { LOG.warn("Caught throwable while evictin... |
### 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:
JCache implements net.sf.jsr107cache.Cache { public boolean isEmpty() { return (size() == 0); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCacheLoader(JCacheLoader cacheLoader); void addListener(Cache... |
### Question:
JCache implements net.sf.jsr107cache.Cache { public boolean containsKey(Object key) { return cache.isKeyInCache(key); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCacheLoader(JCacheLoader cacheLoader)... |
### Question:
JCache implements net.sf.jsr107cache.Cache { public boolean containsValue(Object value) { long start = System.currentTimeMillis(); boolean inCache = cache.isValueInCache(value); long end = System.currentTimeMillis(); if (LOG.isWarnEnabled()) { LOG.warn("Performance Warning: containsValue is not recommende... |
### Question:
JCache implements net.sf.jsr107cache.Cache { public void putAll(Map sourceMap) { if (sourceMap == null) { return; } for (Iterator iterator = sourceMap.keySet().iterator(); iterator.hasNext();) { Object key = iterator.next(); cache.put(new Element(key, sourceMap.get(key))); } } JCache(Ehcache cache); JCac... |
### Question:
JCache implements net.sf.jsr107cache.Cache { public void clear() { cache.removeAll(); } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCacheLoader(JCacheLoader cacheLoader); void addListener(CacheListener... |
### Question:
JCache implements net.sf.jsr107cache.Cache { public Set keySet() { List list = cache.getKeys(); Set set = new HashSet(); set.addAll(list); return set; } JCache(Ehcache cache); JCache(Ehcache cache, net.sf.jsr107cache.CacheLoader cacheLoader); JCache(Ehcache cache, JCacheLoader cacheLoader); void setCach... |
### Question:
JCacheStatistics implements CacheStatistics, Serializable { public void clearStatistics() { statistics.clearStatistics(); } JCacheStatistics(Statistics statistics); int getStatisticsAccuracy(); void clearStatistics(); int getCacheHits(); int getCacheMisses(); int getObjectCount(); float getAverageGetTime(... |
### Question:
SummedSampledCounter extends DerivedSampledCounterImpl { @Override public long getValue() { long l = 0; for (SampledCounter sc : delegates) { l = l + sc.getValue(); } return l; } SummedSampledCounter(SampledCounterConfig config, SampledCounter... delegates); @Override long getValue(); }### Answer:
@Test ... |
### Question:
SelfPopulatingCache extends BlockingCache { public void refresh() throws CacheException { Exception exception = null; Object keyWithException = null; final Collection keys = getKeys(); if (LOG.isLoggable(Level.FINEST)) { LOG.finest(getName() + ": found " + keys.size() + " keys to refresh"); } for (Iterato... |
### Question:
BlockingCache implements Ehcache { protected Ehcache getCache() { return cache; } BlockingCache(final Ehcache cache); String getName(); void setName(String name); boolean isExpired(Element element); Object clone(); RegisteredEventListeners getCacheEventNotificationService(); boolean isElementInMemory(Seri... |
### Question:
BlockingCache implements Ehcache { 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); String getName(); void setName(String name);... |
### Question:
GroupElement extends Element { public Set getMemberKeys() { return (Set) getObjectValue(); } GroupElement(Object key); GroupElement(Object key, Object value, long version,
long creationTime, long lastAccessTime, long nextToLastAccessTime,
long lastUpdateTime, long hitCount); Set g... |
### Question:
CacheManager { public void shutdown() { synchronized (CacheManager.class) { if (status.equals(Status.STATUS_SHUTDOWN)) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("CacheManager already shutdown"); } return; } for (CacheManagerPeerProvider cacheManagerPeerProvider : cacheManagerPeerProviders.values()) { i... |
### Question:
CacheManager { public static CacheManager create() throws CacheException { if (singleton != null) { return singleton; } synchronized (CacheManager.class) { if (singleton == null) { if (LOG.isLoggable(Level.FINE)) { LOG.fine("Creating new CacheManager with default config"); } singleton = new CacheManager()... |
### Question:
Element implements Serializable, Cloneable { public final long getSerializedSize() { if (!isSerializable()) { return 0; } long size = 0; ByteArrayOutputStream bout = new ByteArrayOutputStream(); ObjectOutputStream oos = null; try { oos = new ObjectOutputStream(bout); oos.writeObject(this); size = bout.siz... |
### Question:
Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } Element(Serializable key, Serializable value, long version); Element(Object key, Object value, long version); Element(Object key, Object ... |
### Question:
Element implements Serializable, Cloneable { public final boolean equals(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.getObjectKey())... |
### 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.severe("Could... |
### 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:
ElementResource { @DELETE public void deleteElement() throws NotFoundException { LOG.log(Level.FINE, "DELETE element {0}", element); net.sf.ehcache.Cache ehcache = lookupCache(); if (element.equals("*")) { ehcache.removeAll(); } else { boolean removed = ehcache.remove(element); if (!removed) { throw new N... |
### Question:
ElementResource { @GET public Response getElement() throws NotFoundException { LOG.log(Level.FINE, "GET element {}", element); net.sf.ehcache.Cache ehcache = lookupCache(); net.sf.ehcache.Element ehcacheElement = lookupElement(ehcache); Element localElement = new Element(ehcacheElement, uriInfo.getAbsolut... |
### Question:
CacheResource { @GET public Cache getCache() { LOG.log(Level.FINE, "GET Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); if (ehcache == null) { throw new NotFoundException("Cache not found"); } String cacheAsString = ehcache.toString(); cacheAsString = cacheAsString.substring(0,... |
### Question:
CacheResource { @DELETE public Response deleteCache() { LOG.log(Level.FINE, "DELETE Cache {}" + cache); net.sf.ehcache.Cache ehcache = MANAGER.getCache(cache); Response response; if (ehcache == null) { throw new NotFoundException("Cache not found " + cache); } else { CacheManager.getInstance().removeCache... |
### Question:
HttpDateFormatter { public synchronized Date parseDateFromHttpDate(String date) { try { return httpDateFormat.parse(date); } catch (ParseException e) { LOG.log(Level.FINE, "ParseException on date {0}. 1/1/1970 will be returned", date); return new Date(0); } } HttpDateFormatter(); synchronized String forma... |
### Question:
AsyncWriteBehind implements WriteBehind { public void delete(CacheEntry entry) { readLock.lock(); try { status.checkRunning(); async.add(new DeleteAsyncOperation(createKeySnapshot(entry.getKey()), createElementSnapshot(entry.getElement()))); } finally { readLock.unlock(); } } AsyncWriteBehind(AsyncCoordin... |
### Question:
AsyncWriteBehind implements WriteBehind { public void write(Element element) { readLock.lock(); try { status.checkRunning(); ElementSnapshot snapshot = createElementSnapshot(element); async.add(new WriteAsyncOperation(snapshot)); } finally { readLock.unlock(); } } AsyncWriteBehind(AsyncCoordinator async, ... |
### 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:
EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public boolean isRegionCacheOrphanEvictionEnabled(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().ge... |
### Question:
ToolkitInstanceFactoryImpl implements ToolkitInstanceFactory { void addCacheEntityInfo(final String cacheName, final CacheConfiguration ehcacheConfig, String toolkitCacheName) { if (clusteredCacheManagerEntity == null) { throw new IllegalStateException(format("ClusteredCacheManger entity not configured fo... |
### Question:
EhcacheStatsImpl extends BaseEmitterBean implements EhcacheStats { public int getRegionCacheOrphanEvictionPeriod(String region) { Cache cache = this.cacheManager.getCache(region); if (cache != null && cache.isTerracottaClustered()) { return cache.getCacheConfiguration().getTerracottaConfiguration().getOrp... |
### Question:
Element implements Serializable, Cloneable { @Deprecated public final Serializable getKey() throws CacheException { try { return (Serializable) getObjectKey(); } catch (ClassCastException e) { throw new CacheException("The key " + getObjectKey() + " is not Serializable. Consider using Element.getObjectKey... |
### Question:
Element implements Serializable, Cloneable { @Deprecated public final Serializable getValue() throws CacheException { try { return (Serializable) getObjectValue(); } catch (ClassCastException e) { throw new CacheException("The value " + getObjectValue() + " for key " + getObjectKey() + " is not Serializab... |
### Question:
Element implements Serializable, Cloneable { public final boolean isSerializable() { return isKeySerializable() && (value instanceof Serializable || value == null); } Element(final Serializable key, final Serializable value, final long version); Element(final Object key, final Object value, final long ve... |
### 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:
CopyStrategyHandler { boolean isCopyActive() { return copyOnRead || copyOnWrite; } CopyStrategyHandler(boolean copyOnRead, boolean copyOnWrite, ReadWriteCopyStrategy<Element> copyStrategy); Element copyElementForReadIfNeeded(Element element); }### Answer:
@Test public void given_no_copy_when_isCopyActive... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.