Remove Guava as a dependency

This commit removes Guava as a dependency. Note that Guava will remain
as a test-only dependency (transitively through Elasticsearch through
Jimfs).

Relates elastic/elasticsearchelastic/elasticsearch#13224

Original commit: elastic/x-pack-elasticsearch@fe23d5f25f
This commit is contained in:
Jason Tedor 2015-10-09 14:49:25 -04:00
parent 59ac529e8b
commit b468c74401
5 changed files with 8 additions and 30 deletions

View File

@ -113,11 +113,6 @@
<artifactId>compiler</artifactId> <artifactId>compiler</artifactId>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<scope>provided</scope>
</dependency>
<dependency> <dependency>
<groupId>com.carrotsearch</groupId> <groupId>com.carrotsearch</groupId>
<artifactId>hppc</artifactId> <artifactId>hppc</artifactId>

View File

@ -5,8 +5,6 @@
*/ */
package org.elasticsearch.shield.audit.index; package org.elasticsearch.shield.audit.index;
import com.google.common.base.Splitter;
import org.elasticsearch.ElasticsearchException; import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse; import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest; import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest;
@ -66,11 +64,7 @@ import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import java.util.ArrayList; import java.util.*;
import java.util.EnumSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
@ -696,7 +690,7 @@ public class IndexAuditTrail extends AbstractComponent implements AuditTrail, Cl
List<Tuple<String, Integer>> hostPortPairs = new ArrayList<>(); List<Tuple<String, Integer>> hostPortPairs = new ArrayList<>();
for (String host : hosts) { for (String host : hosts) {
List<String> hostPort = Splitter.on(":").splitToList(host.trim()); List<String> hostPort = Arrays.asList(host.trim().split(":"));
if (hostPort.size() != 1 && hostPort.size() != 2) { if (hostPort.size() != 1 && hostPort.size() != 2) {
logger.warn("invalid host:port specified: [{}] for setting [shield.audit.index.client.hosts]", host); logger.warn("invalid host:port specified: [{}] for setting [shield.audit.index.client.hosts]", host);
} }

View File

@ -5,7 +5,6 @@
*/ */
package org.elasticsearch.shield.authc; package org.elasticsearch.shield.authc;
import com.google.common.base.Predicate;
import org.elasticsearch.ElasticsearchSecurityException; import org.elasticsearch.ElasticsearchSecurityException;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse; import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.node.info.NodeInfo; import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;

View File

@ -5,11 +5,10 @@
*/ */
package org.elasticsearch.watcher.support; package org.elasticsearch.watcher.support;
import com.google.common.base.Equivalence;
import org.elasticsearch.action.search.SearchRequest; import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.common.io.stream.BytesStreamOutput; import org.elasticsearch.common.io.stream.BytesStreamOutput;
import java.io.IOException; import javax.annotation.Nullable;
import java.util.Arrays; import java.util.Arrays;
import static org.elasticsearch.watcher.support.Exceptions.illegalState; import static org.elasticsearch.watcher.support.Exceptions.illegalState;
@ -21,14 +20,17 @@ import static org.elasticsearch.watcher.support.Exceptions.illegalState;
* don't compare search requests in normal runtime... we only do it in the tests. The is here basically * don't compare search requests in normal runtime... we only do it in the tests. The is here basically
* due to the lack of equals/hashcode support in SearchRequest in core. * due to the lack of equals/hashcode support in SearchRequest in core.
*/ */
public final class SearchRequestEquivalence extends Equivalence<SearchRequest> { public final class SearchRequestEquivalence {
public static final SearchRequestEquivalence INSTANCE = new SearchRequestEquivalence(); public static final SearchRequestEquivalence INSTANCE = new SearchRequestEquivalence();
private SearchRequestEquivalence() { private SearchRequestEquivalence() {
} }
@Override public final boolean equivalent(@Nullable SearchRequest a, @Nullable SearchRequest b) {
return a == b ? true : (a != null && b != null ? this.doEquivalent(a, b) : false);
}
protected boolean doEquivalent(SearchRequest r1, SearchRequest r2) { protected boolean doEquivalent(SearchRequest r1, SearchRequest r2) {
try { try {
BytesStreamOutput output1 = new BytesStreamOutput(); BytesStreamOutput output1 = new BytesStreamOutput();
@ -42,15 +44,4 @@ public final class SearchRequestEquivalence extends Equivalence<SearchRequest> {
throw illegalState("could not compare search requests", t); throw illegalState("could not compare search requests", t);
} }
} }
@Override
protected int doHash(SearchRequest request) {
try {
BytesStreamOutput output = new BytesStreamOutput();
request.writeTo(output);
return Arrays.hashCode(output.bytes().toBytes());
} catch (IOException ioe) {
throw illegalState("could not compute hashcode for search request", ioe);
}
}
} }

View File

@ -5,7 +5,6 @@
*/ */
package org.elasticsearch.watcher; package org.elasticsearch.watcher;
import com.google.common.util.concurrent.MoreExecutors;
import org.elasticsearch.cluster.*; import org.elasticsearch.cluster.*;
import org.elasticsearch.cluster.block.ClusterBlocks; import org.elasticsearch.cluster.block.ClusterBlocks;
import org.elasticsearch.cluster.node.DiscoveryNodes; import org.elasticsearch.cluster.node.DiscoveryNodes;