incubator-cassandra-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tristan Tarrant <tristan.tarr...@gmail.com>
Subject Cassandra Connection Pool
Date Tue, 26 Oct 2010 14:22:58 GMT
Dear all,

first of all let me introduce myself (or rather what I do). I am the
developer of the Infinispan Cassandra CacheStore (
http://community.jboss.org/wiki/CassandraCacheStore) which allows
persistence of Infinispan's cache to Cassandra's keyspaces. While developing
the cachestore I needed a connection pool for managing thrift connections.
Since none existed (apart from the ones developed within projects such as
Hector, Pelops and Lucandra), I decided to take Filip Hanik's excellent
jdbc-pool (http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html) and
"port" it to Cassandra.
During the development of the connection pool I had two needs which I solved
locally:

   - split the org.apache.cassandra.thrift class hierarchy from
   apache-cassandra-0.x.y.jar into a apache-cassandra-thrift-0.x.y.jar
   - have a standard org.apache.cassandra.thrift.CassandraDataSource
   interface, which I have defined as:

package org.apache.cassandra.thrift;

import org.apache.cassandra.thrift.Cassandra;
import org.apache.thrift.TException;

public interface CassandraThriftDataSource {
	Cassandra.Client getConnection() throws TException;
	void releaseConnection(Cassandra.Client connection);
}


In alternative a close() method on the Cassandra.Client interface,
which could be overridden to return the connection to the pool instead
of directly closing the underlying transport, although I believe this
might require changes to thrift.
This would provide a standard method for all client libraries to
obtain and release a connection (via a library, via JNDI, etc).

Would a patch against head be well accepted ?

Thanks for any suggestions

Tristan

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message