Downgrade Ehcache to 1.7.2

Version 2.3.0 contains at least one bad thread locking bug where
locks are grabbed but not released in the LDAP cache, resulting in
the server eventually being unable to service any requests without
a JVM restart.

Move back to 1.7.2, a version that we have proven to be stable in
production servers.

Change-Id: I2db36dbb7a3b74435d20de64c3dbb687d4f1c580
Signed-off-by: Shawn O. Pearce <sop@google.com>
This commit is contained in:
Shawn O. Pearce
2011-05-13 20:27:08 -07:00
parent adfe269ffb
commit 8b4dbb8aa3
4 changed files with 29 additions and 200 deletions

View File

@@ -22,6 +22,7 @@ import com.google.gerrit.server.config.ConfigUtil;
import com.google.gerrit.server.config.GerritServerConfig;
import com.google.gerrit.server.config.SitePaths;
import com.google.inject.Inject;
import com.google.inject.ProvisionException;
import com.google.inject.Singleton;
import net.sf.ehcache.CacheManager;
@@ -142,12 +143,9 @@ public class CachePool {
c.setMaxElementsInMemory(getInt(name, "memorylimit", p.memoryLimit()));
long ttl = getSeconds(name, "maxage", p.maxAge());
c.setEternal(ttl == 0);
if (ttl != 0) {
c.setTimeToIdleSeconds(0);
c.setTimeToLiveSeconds(ttl);
}
c.setTimeToIdleSeconds(0);
c.setTimeToLiveSeconds(getSeconds(name, "maxage", p.maxAge()));
c.setEternal(c.getTimeToLiveSeconds() == 0);
if (p.disk() && mgr.getDiskStoreConfiguration() != null) {
c.setMaxElementsOnDisk(getInt(name, "disklimit", p.diskLimit()));
@@ -222,6 +220,8 @@ public class CachePool {
c.setMaxElementsInMemory(1024);
c.setMemoryStoreEvictionPolicyFromObject(MemoryStoreEvictionPolicy.LFU);
c.setTimeToIdleSeconds(0);
c.setTimeToLiveSeconds(0 /* infinite */);
c.setEternal(true);
if (mgr.getDiskStoreConfiguration() != null) {
@@ -237,10 +237,14 @@ public class CachePool {
}
private CacheConfiguration newCache(final String name) {
final CacheConfiguration c;
c = mgr.getDefaultCacheConfiguration().clone();
c.setName(name);
return c;
try {
final CacheConfiguration c;
c = mgr.getDefaultCacheConfiguration().clone();
c.setName(name);
return c;
} catch (CloneNotSupportedException e) {
throw new ProvisionException("Cannot configure cache " + name, e);
}
}
}
}

View File

@@ -29,11 +29,7 @@ import net.sf.ehcache.loader.CacheLoader;
import net.sf.ehcache.statistics.CacheUsageListener;
import net.sf.ehcache.statistics.LiveCacheStatistics;
import net.sf.ehcache.statistics.sampled.SampledCacheStatistics;
import net.sf.ehcache.transaction.manager.TransactionManagerLookup;
import net.sf.ehcache.writer.CacheWriter;
import net.sf.ehcache.writer.CacheWriterManager;
import java.beans.PropertyChangeListener;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
@@ -74,66 +70,55 @@ final class ProxyEhcache implements Ehcache {
//
// Everything else delegates through self.
//
@Override
public void bootstrap() {
self().bootstrap();
}
@Override
public long calculateInMemorySize() throws IllegalStateException,
CacheException {
return self().calculateInMemorySize();
}
@Override
public void clearStatistics() {
self().clearStatistics();
}
@Override
public void dispose() throws IllegalStateException {
self().dispose();
}
@Override
public void evictExpiredElements() {
self().evictExpiredElements();
}
@Override
public void flush() throws IllegalStateException, CacheException {
self().flush();
}
@Override
public Element get(Object key) throws IllegalStateException, CacheException {
return self().get(key);
}
@Override
public Element get(Serializable key) throws IllegalStateException,
CacheException {
return self().get(key);
}
@SuppressWarnings("unchecked")
@Override
public Map getAllWithLoader(Collection keys, Object loaderArgument)
throws CacheException {
return self().getAllWithLoader(keys, loaderArgument);
}
@Override
public float getAverageGetTime() {
return self().getAverageGetTime();
}
@Override
public BootstrapCacheLoader getBootstrapCacheLoader() {
return self().getBootstrapCacheLoader();
}
@Override
public CacheConfiguration getCacheConfiguration() {
if (self == null) {
// In Ehcache 1.7, BlockingCache wants to ask us if we are
@@ -146,423 +131,263 @@ final class ProxyEhcache implements Ehcache {
return self().getCacheConfiguration();
}
@Override
public RegisteredEventListeners getCacheEventNotificationService() {
return self().getCacheEventNotificationService();
}
@Override
public CacheExceptionHandler getCacheExceptionHandler() {
return self().getCacheExceptionHandler();
}
@Override
public CacheManager getCacheManager() {
return self().getCacheManager();
}
@Override
public int getDiskStoreSize() throws IllegalStateException {
return self().getDiskStoreSize();
}
@Override
public String getGuid() {
return self().getGuid();
}
@SuppressWarnings("unchecked")
@Override
public List getKeys() throws IllegalStateException, CacheException {
return self().getKeys();
}
@SuppressWarnings("unchecked")
@Override
public List getKeysNoDuplicateCheck() throws IllegalStateException {
return self().getKeysNoDuplicateCheck();
}
@SuppressWarnings("unchecked")
@Override
public List getKeysWithExpiryCheck() throws IllegalStateException,
CacheException {
return self().getKeysWithExpiryCheck();
}
@Override
public long getMemoryStoreSize() throws IllegalStateException {
return self().getMemoryStoreSize();
}
@Override
public Element getQuiet(Object key) throws IllegalStateException,
CacheException {
return self().getQuiet(key);
}
@Override
public Element getQuiet(Serializable key) throws IllegalStateException,
CacheException {
return self().getQuiet(key);
}
@Override
public List<CacheExtension> getRegisteredCacheExtensions() {
return self().getRegisteredCacheExtensions();
}
@Override
public List<CacheLoader> getRegisteredCacheLoaders() {
return self().getRegisteredCacheLoaders();
}
@Override
public int getSize() throws IllegalStateException, CacheException {
return self().getSize();
}
@Override
public Statistics getStatistics() throws IllegalStateException {
return self().getStatistics();
}
@Override
public int getStatisticsAccuracy() {
return self().getStatisticsAccuracy();
}
@Override
public Status getStatus() {
return self().getStatus();
}
@Override
public Element getWithLoader(Object key, CacheLoader loader,
Object loaderArgument) throws CacheException {
return self().getWithLoader(key, loader, loaderArgument);
}
@Override
public void initialise() {
self().initialise();
}
@Override
public boolean isDisabled() {
return self().isDisabled();
}
@Override
public boolean isElementInMemory(Object key) {
return self().isElementInMemory(key);
}
@Override
public boolean isElementInMemory(Serializable key) {
return self().isElementInMemory(key);
}
@Override
public boolean isElementOnDisk(Object key) {
return self().isElementOnDisk(key);
}
@Override
public boolean isElementOnDisk(Serializable key) {
return self().isElementOnDisk(key);
}
@Override
public boolean isExpired(Element element) throws IllegalStateException,
NullPointerException {
return self().isExpired(element);
}
@Override
public boolean isKeyInCache(Object key) {
return self().isKeyInCache(key);
}
@Override
public boolean isValueInCache(Object value) {
return self().isValueInCache(value);
}
@Override
public void load(Object key) throws CacheException {
self().load(key);
}
@SuppressWarnings("unchecked")
@Override
public void loadAll(Collection keys, Object argument) throws CacheException {
self().loadAll(keys, argument);
}
@Override
public void put(Element element, boolean doNotNotifyCacheReplicators)
throws IllegalArgumentException, IllegalStateException, CacheException {
self().put(element, doNotNotifyCacheReplicators);
}
@Override
public void put(Element element) throws IllegalArgumentException,
IllegalStateException, CacheException {
self().put(element);
}
@Override
public void putQuiet(Element element) throws IllegalArgumentException,
IllegalStateException, CacheException {
self().putQuiet(element);
}
@Override
public void registerCacheExtension(CacheExtension cacheExtension) {
self().registerCacheExtension(cacheExtension);
}
@Override
public void registerCacheLoader(CacheLoader cacheLoader) {
self().registerCacheLoader(cacheLoader);
}
@Override
public boolean remove(Object key, boolean doNotNotifyCacheReplicators)
throws IllegalStateException {
return self().remove(key, doNotNotifyCacheReplicators);
}
@Override
public boolean remove(Object key) throws IllegalStateException {
return self().remove(key);
}
@Override
public boolean remove(Serializable key, boolean doNotNotifyCacheReplicators)
throws IllegalStateException {
return self().remove(key, doNotNotifyCacheReplicators);
}
@Override
public boolean remove(Serializable key) throws IllegalStateException {
return self().remove(key);
}
@Override
public void removeAll() throws IllegalStateException, CacheException {
self().removeAll();
}
@Override
public void removeAll(boolean doNotNotifyCacheReplicators)
throws IllegalStateException, CacheException {
self().removeAll(doNotNotifyCacheReplicators);
}
@Override
public boolean removeQuiet(Object key) throws IllegalStateException {
return self().removeQuiet(key);
}
@Override
public boolean removeQuiet(Serializable key) throws IllegalStateException {
return self().removeQuiet(key);
}
@Override
public void setBootstrapCacheLoader(BootstrapCacheLoader bootstrapCacheLoader)
throws CacheException {
self().setBootstrapCacheLoader(bootstrapCacheLoader);
}
@Override
public void setCacheExceptionHandler(
CacheExceptionHandler cacheExceptionHandler) {
self().setCacheExceptionHandler(cacheExceptionHandler);
}
@Override
public void setCacheManager(CacheManager cacheManager) {
self().setCacheManager(cacheManager);
}
@Override
public void setDisabled(boolean disabled) {
self().setDisabled(disabled);
}
@Override
public void setDiskStorePath(String diskStorePath) throws CacheException {
self().setDiskStorePath(diskStorePath);
}
@Override
public void setStatisticsAccuracy(int statisticsAccuracy) {
self().setStatisticsAccuracy(statisticsAccuracy);
}
@Override
public void unregisterCacheExtension(CacheExtension cacheExtension) {
self().unregisterCacheExtension(cacheExtension);
}
@Override
public void unregisterCacheLoader(CacheLoader cacheLoader) {
self().unregisterCacheLoader(cacheLoader);
}
@Override
public Object getInternalContext() {
return self().getInternalContext();
return self.getInternalContext();
}
@Override
public LiveCacheStatistics getLiveCacheStatistics() throws IllegalStateException {
return self().getLiveCacheStatistics();
return self.getLiveCacheStatistics();
}
@Override
public SampledCacheStatistics getSampledCacheStatistics() {
return self().getSampledCacheStatistics();
return self.getSampledCacheStatistics();
}
@Override
public int getSizeBasedOnAccuracy(int statisticsAccuracy) throws IllegalArgumentException,
IllegalStateException, CacheException {
return self().getSizeBasedOnAccuracy(statisticsAccuracy);
return self.getSizeBasedOnAccuracy(statisticsAccuracy);
}
@Override
public boolean isSampledStatisticsEnabled() {
return self().isSampledStatisticsEnabled();
return self.isSampledStatisticsEnabled();
}
@Override
public boolean isStatisticsEnabled() {
return self().isStatisticsEnabled();
return self.isStatisticsEnabled();
}
@Override
public void registerCacheUsageListener(CacheUsageListener cacheUsageListener)
throws IllegalStateException {
self().registerCacheUsageListener(cacheUsageListener);
self.registerCacheUsageListener(cacheUsageListener);
}
@Override
public void removeCacheUsageListener(CacheUsageListener cacheUsageListener)
throws IllegalStateException {
self().removeCacheUsageListener(cacheUsageListener);
self.removeCacheUsageListener(cacheUsageListener);
}
@Override
public void setSampledStatisticsEnabled(boolean enableStatistics) {
self().setSampledStatisticsEnabled(enableStatistics);
self.setSampledStatisticsEnabled(enableStatistics);
}
@Override
public void setStatisticsEnabled(boolean enableStatistics) {
self().setStatisticsEnabled(enableStatistics);
}
@Override
public void putWithWriter(Element element) throws IllegalArgumentException, IllegalStateException, CacheException {
self().putWithWriter(element);
}
@Override
public Element putIfAbsent(Element element) throws NullPointerException {
return self().putIfAbsent(element);
}
@Override
public boolean removeElement(Element element) throws NullPointerException {
return self().removeElement(element);
}
@Override
public boolean replace(Element element, Element element1) throws NullPointerException, IllegalArgumentException {
return self().replace(element, element1);
}
@Override
public Element replace(Element element) throws NullPointerException {
return self().replace(element);
}
@Override
public boolean removeWithWriter(Object o) throws IllegalStateException, CacheException {
return self().removeWithWriter(o);
}
@Override
public long calculateOffHeapSize() throws IllegalStateException, CacheException {
return self().calculateOffHeapSize();
}
@Override
public long getOffHeapStoreSize() throws IllegalStateException {
return self().getOffHeapStoreSize();
}
@Override
public void registerCacheWriter(CacheWriter cacheWriter) {
self().registerCacheWriter(cacheWriter);
}
@Override
public void unregisterCacheWriter() {
self().unregisterCacheWriter();
}
@Override
public CacheWriter getRegisteredCacheWriter() {
return self().getRegisteredCacheWriter();
}
@Override
public void disableDynamicFeatures() {
self().disableDynamicFeatures();
}
@Override
public CacheWriterManager getWriterManager() {
return self().getWriterManager();
}
@Override
public boolean isClusterCoherent() {
return self().isClusterCoherent();
}
@Override
public boolean isNodeCoherent() {
return self().isNodeCoherent();
}
@Override
public void setNodeCoherent(boolean b) throws UnsupportedOperationException {
self().setNodeCoherent(b);
}
@Override
public void waitUntilClusterCoherent() throws UnsupportedOperationException {
self().waitUntilClusterCoherent();
}
@Override
public void setTransactionManagerLookup(TransactionManagerLookup transactionManagerLookup) {
self().setTransactionManagerLookup(transactionManagerLookup);
}
@Override
public void addPropertyChangeListener(PropertyChangeListener propertyChangeListener) {
self().addPropertyChangeListener(propertyChangeListener);
}
@Override
public void removePropertyChangeListener(PropertyChangeListener propertyChangeListener) {
self().removePropertyChangeListener(propertyChangeListener);
self.setStatisticsEnabled(enableStatistics);
}
}