Upgrade to guava 12.0, closes #1920.
This commit is contained in:
parent
7bac883837
commit
76e1c3a017
2
pom.xml
2
pom.xml
|
@ -84,7 +84,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.guava</groupId>
|
<groupId>com.google.guava</groupId>
|
||||||
<artifactId>guava</artifactId>
|
<artifactId>guava</artifactId>
|
||||||
<version>11.0.2</version>
|
<version>12.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
package org.elasticsearch.common.cache;
|
|
||||||
|
|
||||||
import com.google.common.cache.CacheBuilder;
|
|
||||||
|
|
||||||
import java.lang.reflect.Method;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public class CacheBuilderHelper {
|
|
||||||
|
|
||||||
private static final Method cacheBuilderDisableStatsMethod;
|
|
||||||
|
|
||||||
static {
|
|
||||||
Method cacheBuilderDisableStatsMethodX = null;
|
|
||||||
try {
|
|
||||||
cacheBuilderDisableStatsMethodX = CacheBuilder.class.getDeclaredMethod("disableStats");
|
|
||||||
cacheBuilderDisableStatsMethodX.setAccessible(true);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
cacheBuilderDisableStatsMethod = cacheBuilderDisableStatsMethodX;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void disableStats(CacheBuilder cacheBuilder) {
|
|
||||||
if (cacheBuilderDisableStatsMethod != null) {
|
|
||||||
try {
|
|
||||||
cacheBuilderDisableStatsMethod.invoke(cacheBuilder);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
// ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -26,7 +26,6 @@ import com.google.common.cache.RemovalListener;
|
||||||
import com.google.common.cache.RemovalNotification;
|
import com.google.common.cache.RemovalNotification;
|
||||||
import org.elasticsearch.ElasticSearchException;
|
import org.elasticsearch.ElasticSearchException;
|
||||||
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
import org.elasticsearch.cluster.metadata.IndexMetaData;
|
||||||
import org.elasticsearch.common.cache.CacheBuilderHelper;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.metrics.CounterMetric;
|
import org.elasticsearch.common.metrics.CounterMetric;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -80,7 +79,6 @@ public class ResidentFieldDataCache extends AbstractConcurrentMapFieldDataCache
|
||||||
if (expire != null) {
|
if (expire != null) {
|
||||||
cacheBuilder.expireAfterAccess(expire.nanos(), TimeUnit.NANOSECONDS);
|
cacheBuilder.expireAfterAccess(expire.nanos(), TimeUnit.NANOSECONDS);
|
||||||
}
|
}
|
||||||
CacheBuilderHelper.disableStats(cacheBuilder);
|
|
||||||
return cacheBuilder.build();
|
return cacheBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@ import com.google.common.cache.Cache;
|
||||||
import com.google.common.cache.CacheBuilder;
|
import com.google.common.cache.CacheBuilder;
|
||||||
import com.google.common.cache.RemovalListener;
|
import com.google.common.cache.RemovalListener;
|
||||||
import com.google.common.cache.RemovalNotification;
|
import com.google.common.cache.RemovalNotification;
|
||||||
import org.elasticsearch.common.cache.CacheBuilderHelper;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.metrics.CounterMetric;
|
import org.elasticsearch.common.metrics.CounterMetric;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
|
@ -47,7 +46,6 @@ public class SoftFieldDataCache extends AbstractConcurrentMapFieldDataCache impl
|
||||||
@Override
|
@Override
|
||||||
protected Cache<String, FieldData> buildFieldDataMap() {
|
protected Cache<String, FieldData> buildFieldDataMap() {
|
||||||
CacheBuilder<String, FieldData> cacheBuilder = CacheBuilder.newBuilder().softValues().removalListener(this);
|
CacheBuilder<String, FieldData> cacheBuilder = CacheBuilder.newBuilder().softValues().removalListener(this);
|
||||||
CacheBuilderHelper.disableStats(cacheBuilder);
|
|
||||||
return cacheBuilder.build();
|
return cacheBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,6 @@ import com.google.common.cache.CacheBuilder;
|
||||||
import org.apache.lucene.queryParser.QueryParserSettings;
|
import org.apache.lucene.queryParser.QueryParserSettings;
|
||||||
import org.apache.lucene.search.Query;
|
import org.apache.lucene.search.Query;
|
||||||
import org.elasticsearch.ElasticSearchException;
|
import org.elasticsearch.ElasticSearchException;
|
||||||
import org.elasticsearch.common.cache.CacheBuilderHelper;
|
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
import org.elasticsearch.common.settings.Settings;
|
import org.elasticsearch.common.settings.Settings;
|
||||||
import org.elasticsearch.common.unit.TimeValue;
|
import org.elasticsearch.common.unit.TimeValue;
|
||||||
|
@ -59,8 +58,6 @@ public class ResidentQueryParserCache extends AbstractIndexComponent implements
|
||||||
cacheBuilder.expireAfterAccess(expire.nanos(), TimeUnit.NANOSECONDS);
|
cacheBuilder.expireAfterAccess(expire.nanos(), TimeUnit.NANOSECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
CacheBuilderHelper.disableStats(cacheBuilder);
|
|
||||||
|
|
||||||
this.cache = cacheBuilder.build();
|
this.cache = cacheBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,6 @@ import com.google.common.cache.RemovalListener;
|
||||||
import com.google.common.cache.RemovalNotification;
|
import com.google.common.cache.RemovalNotification;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import org.elasticsearch.cluster.metadata.MetaData;
|
import org.elasticsearch.cluster.metadata.MetaData;
|
||||||
import org.elasticsearch.common.cache.CacheBuilderHelper;
|
|
||||||
import org.elasticsearch.common.collect.MapBuilder;
|
import org.elasticsearch.common.collect.MapBuilder;
|
||||||
import org.elasticsearch.common.component.AbstractComponent;
|
import org.elasticsearch.common.component.AbstractComponent;
|
||||||
import org.elasticsearch.common.inject.Inject;
|
import org.elasticsearch.common.inject.Inject;
|
||||||
|
@ -110,8 +109,6 @@ public class IndicesFilterCache extends AbstractComponent implements RemovalList
|
||||||
cacheBuilder.expireAfterAccess(expire.millis(), TimeUnit.MILLISECONDS);
|
cacheBuilder.expireAfterAccess(expire.millis(), TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
CacheBuilderHelper.disableStats(cacheBuilder);
|
|
||||||
|
|
||||||
cache = cacheBuilder.build();
|
cache = cacheBuilder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue