tristantarrant / cassandra-connection-pool Goto Github PK
View Code? Open in Web Editor NEWCassandra Connection Pool
Cassandra Connection Pool
If the CassandraThriftDataSource is taken from JNDI, then all calls should be proxied there.
I changed some stuff in the pom as it was not finding the parent project. I also added the riptano repository for cassandra and thrift dependencies (feel free to use this, we are committed to maintaining it). The additional changes in the pom are probably defined in the missing parent, but got the pom file working.
The diff follows...
diff --git a/pom.xml b/pom.xml
index d973465..e9899d6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,9 +1,4 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <parent>
- <groupId>net.dataforte</groupId>
- <artifactId>dataforte-parent</artifactId>
- <version>3</version>
- </parent>
<modelVersion>4.0.0</modelVersion>
<groupId>net.dataforte.cassandra</groupId>
@@ -32,19 +27,25 @@
</distributionManagement>
<dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.8.1</version>
+ <scope>test</scope>
+ </dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
</dependency>
<dependency>
- <groupId>org.apache.thrift</groupId>
+ <groupId>libthrift</groupId>
<artifactId>libthrift</artifactId>
<version>917130</version>
</dependency>
<dependency>
- <groupId>org.apache</groupId>
- <artifactId>cassandra</artifactId>
+ <groupId>org.apache.cassandra</groupId>
+ <artifactId>apache-cassandra</artifactId>
<version>0.6.5</version>
</dependency>
<dependency>
@@ -98,6 +99,20 @@
</scm>
<build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ <optimize>true</optimize>
+ <debug>true</debug>
+ <showDeprecation>true</showDeprecation>
+ <showWarnings>true</showWarnings>
+ </configuration>
+ </plugin>
+ </plugins>
<testResources>
<testResource>
<directory>src/test/resources</directory>
@@ -105,4 +120,11 @@
</testResource>
</testResources>
</build>
+ <repositories>
+ <repository>
+ <id>riptano</id>
+ <name>riptano</name>
+ <url>http://mvn.riptano.com/content/repositories/public/</url>
+ </repository>
+ </repositories>
</project>
Access to field connectionMap (which is not thread-safe) in class ConnectionPool is not synchronized properly. The problem is in method createConnection where new connections are created and put into the map however more threads can access the map at once - the locking mechanism on the connection does not protect the map. We encountered the problem in production resulting in infinite loop (caused by corrupted internal state of the map).
I suggest to replace HashMap with ConcurrentHashMap.
Implement a RAR for JBoss so that a connection pool can be defined via a -ds.xml file.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.