Merge pull request elastic/elasticsearch#771 from jasontedor/guava-be-gone

Remove Guava as a dependency

Original commit: elastic/x-pack-elasticsearch@93e65a9fc9
This commit is contained in:
Jason Tedor 2015-10-09 15:52:35 -04:00
commit 1fc674abfd
5 changed files with 8 additions and 30 deletions

View File

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

View File

@ -5,8 +5,6 @@
*/
package org.elasticsearch.shield.audit.index;
import com.google.common.base.Splitter;
import org.elasticsearch.ElasticsearchException;
import org.elasticsearch.action.admin.cluster.state.ClusterStateResponse;
import org.elasticsearch.action.admin.indices.exists.indices.IndicesExistsRequest;
@ -66,11 +64,7 @@ import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.SocketAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.*;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.atomic.AtomicReference;
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<>();
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) {
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;
import com.google.common.base.Predicate;
import org.elasticsearch.ElasticsearchSecurityException;
import org.elasticsearch.action.admin.cluster.health.ClusterHealthResponse;
import org.elasticsearch.action.admin.cluster.node.info.NodeInfo;

View File

@ -5,11 +5,10 @@
*/
package org.elasticsearch.watcher.support;
import com.google.common.base.Equivalence;
import org.elasticsearch.action.search.SearchRequest;
import org.elasticsearch.common.io.stream.BytesStreamOutput;
import java.io.IOException;
import javax.annotation.Nullable;
import java.util.Arrays;
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
* 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();
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) {
try {
BytesStreamOutput output1 = new BytesStreamOutput();
@ -42,15 +44,4 @@ public final class SearchRequestEquivalence extends Equivalence<SearchRequest> {
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;
import com.google.common.util.concurrent.MoreExecutors;
import org.elasticsearch.cluster.*;
import org.elasticsearch.cluster.block.ClusterBlocks;
import org.elasticsearch.cluster.node.DiscoveryNodes;