Permalink
Browse files

pom cleanup, remove dependencies pulled in through cassandra, move de…

…pency versions to parent pom

exluce thrift servlet and http client dependencies
remove Avro classes and dependency
remove dependency on org.cliffc.high_scale_lib, ConcurrentHashMap is good enough
add *.swp to git ignore
  • Loading branch information...
1 parent 3249159 commit 707d3c46428da1a22dab02ac74c732f8622eabc5 @sbridges sbridges committed Aug 14, 2011
View
@@ -13,3 +13,4 @@ out
*.iws
*.iml
.springBeans
+*.swp
View
@@ -95,12 +95,10 @@
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>2.4</version>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
- <version>1.5.3</version>
</dependency>
<dependency>
<groupId>org.apache.cassandra</groupId>
@@ -109,94 +107,33 @@
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
- </dependency>
- <dependency>
- <groupId>me.prettyprint</groupId>
- <artifactId>hector-test</artifactId>
- <version>${pom.version}</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.yaml</groupId>
- <artifactId>snakeyaml</artifactId>
- <version>1.6</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>r08</version>
- </dependency>
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- <version>3.2.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.apache.cassandra.deps</groupId>
- <artifactId>avro</artifactId>
- <version>1.4.0-cassandra-1</version>
- <scope>test</scope>
<exclusions>
<exclusion>
- <artifactId>netty</artifactId>
- <groupId>org.jboss.netty</groupId>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
- <artifactId>paranamer</artifactId>
- <groupId>com.thoughtworks.paranamer</groupId>
- </exclusion>
- <exclusion>
- <artifactId>paranamer-ant</artifactId>
- <groupId>com.thoughtworks.paranamer</groupId>
- </exclusion>
- <exclusion>
- <artifactId>velocity</artifactId>
- <groupId>org.apache.velocity</groupId>
+ <groupId>org.apache.httpcomponents</groupId>
+ <artifactId>httpclient</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
- <groupId>org.antlr</groupId>
- <artifactId>antlr</artifactId>
- <version>3.1.3</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.googlecode.concurrentlinkedhashmap</groupId>
- <artifactId>concurrentlinkedhashmap-lru</artifactId>
- <version>1.1</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>com.github.stephenc.high-scale-lib</groupId>
- <artifactId>high-scale-lib</artifactId>
- </dependency>
- <dependency>
- <groupId>org.apache.cassandra</groupId>
- <artifactId>cassandra-javautils</artifactId>
- <optional>true</optional>
+ <groupId>com.google.guava</groupId>
+ <artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>jul-to-slf4j</artifactId>
- </dependency>
- <dependency>
<groupId>com.github.stephenc.eaio-uuid</groupId>
<artifactId>uuid</artifactId>
- <version>3.2.0</version>
</dependency>
<dependency>
<groupId>com.ecyrd.speed4j</groupId>
<artifactId>speed4j</artifactId>
- <version>0.9</version>
</dependency>
-
<!-- Note the optional tag. If you need to use fastinfoset serialization, you must include this dependency in your project! -->
<dependency>
<artifactId>FastInfoset</artifactId>
@@ -223,6 +160,12 @@
<!-- test dependencies -->
<dependency>
+ <groupId>me.prettyprint</groupId>
+ <artifactId>hector-test</artifactId>
+ <version>${pom.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
@@ -243,6 +186,11 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>jul-to-slf4j</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version>
@@ -3,6 +3,8 @@
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;
@@ -11,16 +13,16 @@
import me.prettyprint.hector.api.exceptions.HectorException;
import me.prettyprint.hector.api.exceptions.PoolExhaustedException;
-import org.cliffc.high_scale_lib.NonBlockingHashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ConcurrentHClientPool implements HClientPool {
private static final Logger log = LoggerFactory.getLogger(ConcurrentHClientPool.class);
+ private static final Object PRESENT = new Object();
private final ArrayBlockingQueue<HThriftClient> availableClientQueue;
- private final NonBlockingHashSet<HThriftClient> activeClients;
+ private final ConcurrentMap<HThriftClient, Object> activeClients;
private final CassandraHost cassandraHost;
//private final CassandraClientMonitor monitor;
@@ -33,7 +35,7 @@ public ConcurrentHClientPool(CassandraHost host) {
this.cassandraHost = host;
availableClientQueue = new ArrayBlockingQueue<HThriftClient>(cassandraHost.getMaxActive(), true);
- activeClients = new NonBlockingHashSet<HThriftClient>();
+ activeClients = new ConcurrentHashMap<HThriftClient, Object>();
numBlocked = new AtomicInteger();
active = new AtomicBoolean(true);
@@ -105,7 +107,7 @@ public HThriftClient borrowClient() throws HectorException {
if ( cassandraClient == null ) {
throw new HectorException("HConnectionManager returned a null client after aquisition - are we shutting down?");
}
- activeClients.add(cassandraClient);
+ activeClients.put(cassandraClient, PRESENT);
} finally {
numBlocked.decrementAndGet();
}
@@ -123,7 +125,7 @@ private HThriftClient greedyCreate() {
log.debug("Greedy creation of new client");
}
HThriftClient client = new HThriftClient(cassandraHost).open();
- activeClients.add(client);
+ activeClients.put(client, PRESENT);
return client;
}
@@ -6,6 +6,8 @@
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
import me.prettyprint.cassandra.service.CassandraClientMonitor;
import me.prettyprint.cassandra.service.CassandraClientMonitor.Counter;
@@ -27,16 +29,15 @@
import org.apache.cassandra.thrift.AuthenticationRequest;
import org.apache.cassandra.thrift.Cassandra;
-import org.cliffc.high_scale_lib.NonBlockingHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HConnectionManager {
private static final Logger log = LoggerFactory.getLogger(HConnectionManager.class);
- private final NonBlockingHashMap<CassandraHost,HClientPool> hostPools;
- private final NonBlockingHashMap<CassandraHost,HClientPool> suspendedHostPools;
+ private final ConcurrentMap<CassandraHost,HClientPool> hostPools;
+ private final ConcurrentMap<CassandraHost,HClientPool> suspendedHostPools;
private final Collection<HClientPool> hostPoolValues;
private final String clusterName;
private CassandraHostRetryService cassandraHostRetryService;
@@ -53,8 +54,8 @@
public HConnectionManager(String clusterName, CassandraHostConfigurator cassandraHostConfigurator) {
loadBalancingPolicy = cassandraHostConfigurator.getLoadBalancingPolicy();
clock = cassandraHostConfigurator.getClockResolution();
- hostPools = new NonBlockingHashMap<CassandraHost, HClientPool>();
- suspendedHostPools = new NonBlockingHashMap<CassandraHost, HClientPool>();
+ hostPools = new ConcurrentHashMap<CassandraHost, HClientPool>();
+ suspendedHostPools = new ConcurrentHashMap<CassandraHost, HClientPool>();
this.clusterName = clusterName;
if ( cassandraHostConfigurator.getRetryDownedHosts() ) {
cassandraHostRetryService = new CassandraHostRetryService(this, cassandraHostConfigurator);
@@ -1,42 +0,0 @@
-package me.prettyprint.cassandra.model.avro;
-
-import me.prettyprint.cassandra.model.AbstractColumnQuery;
-import me.prettyprint.cassandra.model.KeyspaceOperationCallback;
-import me.prettyprint.cassandra.model.QueryResultImpl;
-import me.prettyprint.cassandra.service.KeyspaceService;
-import me.prettyprint.hector.api.Keyspace;
-import me.prettyprint.hector.api.Serializer;
-import me.prettyprint.hector.api.beans.HColumn;
-import me.prettyprint.hector.api.exceptions.HectorException;
-import me.prettyprint.hector.api.query.ColumnQuery;
-import me.prettyprint.hector.api.query.QueryResult;
-
-/**
- * Avro implementation of the ColumnQuery type.
- *
- * @author Ran Tavory
- *
- * @param <N> column name type
- * @param <V> value type
- */
-public final class AvroColumnQuery<K, N, V> extends AbstractColumnQuery<K, N, V>
- implements ColumnQuery<K, N, V> {
-
- public AvroColumnQuery(Keyspace keyspace, Serializer<K> keySerializer,
- Serializer<N> nameSerializer,
- Serializer<V> valueSerializer) {
- super(keyspace, keySerializer, nameSerializer, valueSerializer);
- }
-
- @Override
- public QueryResult<HColumn<N, V>> execute() {
- return new QueryResultImpl<HColumn<N, V>>(keyspace.doExecute(
- new KeyspaceOperationCallback<HColumn<N, V>>() {
- @Override
- public HColumn<N, V> doInKeyspace(KeyspaceService ks) throws HectorException {
- //TODO: not implemented yet.
- return null;
- }
- }), this);
- }
-}
@@ -1,27 +0,0 @@
-package me.prettyprint.cassandra.model.avro;
-
-import me.prettyprint.cassandra.model.AbstractSubColumnQuery;
-import me.prettyprint.hector.api.Keyspace;
-import me.prettyprint.hector.api.Serializer;
-import me.prettyprint.hector.api.query.SubColumnQuery;
-
-/**
- * Thrift implementation of SubColumnQuery
- * @author Ran Tavory
- *
- * @param <SN> supercolumn name type
- * @param <N> column name type
- * @param <V> column value type
- */
-public final class AvroSubColumnQuery<K, SN,N,V> extends AbstractSubColumnQuery<K, SN, N, V>
- implements SubColumnQuery<K, SN, N, V> {
-
- public AvroSubColumnQuery(Keyspace keyspace,
- Serializer<K> keySerializer,
- Serializer<SN> sNameSerializer,
- Serializer<N> nameSerializer,
- Serializer<V> valueSerializer) {
- super(keyspace, keySerializer, sNameSerializer, nameSerializer, valueSerializer);
- }
-
-}
@@ -1,40 +0,0 @@
-package me.prettyprint.cassandra.model.avro;
-
-import static me.prettyprint.cassandra.utils.Assert.notNull;
-import me.prettyprint.cassandra.model.AbstractSuperColumnQuery;
-import me.prettyprint.hector.api.Keyspace;
-import me.prettyprint.hector.api.Serializer;
-import me.prettyprint.hector.api.beans.HSuperColumn;
-import me.prettyprint.hector.api.query.QueryResult;
-import me.prettyprint.hector.api.query.SuperColumnQuery;
-
-import org.apache.commons.lang.NotImplementedException;
-
-/**
- * Avro implementation of the SuperColumnQuery
- *
- * @author Ran Tavory
- *
- * @param <SN>
- * @param <N>
- * @param <V>
- */
-public final class AvroSuperColumnQuery<K, SN,N,V> extends AbstractSuperColumnQuery<K, SN, N, V>
- implements SuperColumnQuery<K, SN, N, V> {
-
- public AvroSuperColumnQuery(Keyspace keyspace,
- Serializer<K> keySerializer,
- Serializer<SN> sNameSerializer,
- Serializer<N> nameSerializer,
- Serializer<V> valueSerializer) {
- super(keyspace, keySerializer, sNameSerializer, nameSerializer, valueSerializer);
- }
-
- @Override
- public QueryResult<HSuperColumn<SN, N, V>> execute() {
- notNull(columnFamilyName, "columnFamilyName is null");
- notNull(superName, "superName is null");
- // TODO: implement
- throw new NotImplementedException();
- }
-}
Oops, something went wrong.

0 comments on commit 707d3c4

Please sign in to comment.