updated to new Astyanax release 1.5+

git-svn-id: http://svn.research-infrastructures.eu/public/d4science/gcube/trunk/portal/social-networking-library@67815 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
Massimiliano Assante 2013-01-16 22:59:09 +00:00
parent 8566ca2bd1
commit 3d5b381cd4
6 changed files with 7648 additions and 10 deletions

File diff suppressed because it is too large Load Diff

View File

@ -159,8 +159,13 @@
<dependency>
<groupId>com.netflix.astyanax</groupId>
<artifactId>astyanax</artifactId>
<version>1.0.3</version>
</dependency>
<version>1.56.21</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8</version>
</dependency>
<dependency>
<groupId>com.google</groupId>
<artifactId>gwt-jsonmaker</artifactId>

View File

@ -12,12 +12,14 @@ import com.netflix.astyanax.AstyanaxContext;
import com.netflix.astyanax.Cluster;
import com.netflix.astyanax.Keyspace;
import com.netflix.astyanax.connectionpool.NodeDiscoveryType;
import com.netflix.astyanax.connectionpool.OperationResult;
import com.netflix.astyanax.connectionpool.exceptions.ConnectionException;
import com.netflix.astyanax.connectionpool.impl.ConnectionPoolConfigurationImpl;
import com.netflix.astyanax.connectionpool.impl.CountingConnectionPoolMonitor;
import com.netflix.astyanax.ddl.ColumnDefinition;
import com.netflix.astyanax.ddl.ColumnFamilyDefinition;
import com.netflix.astyanax.ddl.KeyspaceDefinition;
import com.netflix.astyanax.ddl.SchemaChangeResult;
import com.netflix.astyanax.impl.AstyanaxConfigurationImpl;
import com.netflix.astyanax.thrift.ThriftFamilyFactory;
import com.netflix.astyanax.thrift.ddl.ThriftColumnDefinitionImpl;
@ -61,7 +63,7 @@ public class CassandraClusterConnection {
.withAstyanaxConfiguration(new AstyanaxConfigurationImpl())
.withConnectionPoolConfiguration(
new ConnectionPoolConfigurationImpl(
clusterName).setMaxConnsPerHost(1)
clusterName).setMaxConnsPerHost(100)
.setSeeds(host))
.withConnectionPoolMonitor(
new CountingConnectionPoolMonitor())
@ -113,9 +115,9 @@ public class CassandraClusterConnection {
if (dropSchema && keyspaceDef != null) {
_log.info("Dropping Keyspace: " + keyspaceName + " ...");
try {
String returned = cluster.dropKeyspace(keyspaceName);
OperationResult<SchemaChangeResult> returned = cluster.dropKeyspace(keyspaceName);
Thread.sleep(2000);
_log.info("Dropped " + returned);
_log.info("Dropped " + returned.getResult().toString());
} catch (ConnectionException e) {
_log.error("Dropping Keyspace operation Failed ... " + keyspaceName + " does NOT exists");
return;

View File

@ -572,8 +572,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
if (toAdd.getType() == FeedType.TWEET || toAdd.getType() == FeedType.SHARE || toAdd.getType() == FeedType.PUBLISH) {
toReturn.add(toAdd);
_log.trace("Read recent feed: " + feedIDs.get(i));
} else
} else {
_log.trace("Read and skipped feed: " + feedIDs.get(i) + " (Removed Feed)");
quantity += 1; //increase the quantity in case of removed feed
//check if quantity is greater than user feeds
quantity = (quantity > feedIDs.size()) ? feedIDs.size() : quantity;
}
}
return toReturn;
}
@ -600,8 +604,12 @@ public final class DBCassandraAstyanaxImpl implements DatabookStore {
if (toAdd.getType() == FeedType.TWEET || toAdd.getType() == FeedType.SHARE || toAdd.getType() == FeedType.PUBLISH) {
toReturn.add(toAdd);
_log.trace("Read recent feed: " + feedIDs.get(i));
} else
_log.trace("Read and skipped feed: " + feedIDs.get(i) + " (Removed Feed)");
} else {
_log.trace("Read and skipped feed: " + feedIDs.get(i) + " (Removed Feed) .");
quantity += 1; //increase the quantity in case of removed feed
//check if quantity is greater than user feeds
quantity = (quantity > feedIDs.size()) ? feedIDs.size() : quantity;
}
}
return toReturn;
}

View File

@ -25,7 +25,7 @@ public class DatabookCassandraTest {
@BeforeClass
public static void setup() throws Exception {
store = new DBCassandraAstyanaxImpl(false); //set to true if you want to drop the KeySpace and recreate it
store = new DBCassandraAstyanaxImpl(true); //set to true if you want to drop the KeySpace and recreate it
}
@AfterClass

View File

@ -1,4 +1,4 @@
host = node1.p.cassandra.research-infrastructures.eu
port = 9160
cluster = D4Science Cluster
keyspace = TestKS
keyspace = DevKeySpace