Permalink
Browse files

src/main/java/com/datastax/tutorial/GetCityRawThrift.java

  • Loading branch information...
1 parent 5a94666 commit 376820725c68e2b7ab9a3dab81fd60bd57432146 zznate committed Jan 27, 2012
Showing with 0 additions and 51 deletions.
  1. +0 −51 src/main/java/com/datastax/tutorial/GetCityRawThrift.java
@@ -1,51 +0,0 @@
-package com.datastax.tutorial;
-
-import me.prettyprint.cassandra.connection.HClientPool;
-import me.prettyprint.cassandra.connection.HThriftClient;
-import me.prettyprint.hector.api.Keyspace;
-import me.prettyprint.hector.api.ResultStatus;
-
-import org.apache.cassandra.thrift.Cassandra;
-import org.apache.cassandra.thrift.ColumnOrSuperColumn;
-import org.apache.cassandra.thrift.ColumnPath;
-import org.apache.cassandra.thrift.ConsistencyLevel;
-import org.apache.cassandra.utils.ByteBufferUtil;
-
-/**
- * For the curios... behold raw Thrift API.
- *
- * @author nate
- *
- */
-public class GetCityRawThrift extends TutorialCommand {
-
- public GetCityRawThrift(Keyspace keyspace) {
- super(keyspace);
- }
-
- @Override
- public ResultStatus execute() {
- HClientPool pool = null;
- HThriftClient client = null;
- try {
- // ewww. Dont do this.
- // ... maybe expose a 'getThriftClient' at a very high level somewhere?
- pool = TutorialBase.tutorialCluster.getConnectionManager().getActivePools().iterator().next();
- client = pool.borrowClient();
-
- Cassandra.Client cassandra = client.getCassandra();
- cassandra.set_keyspace("Tutorial");
- ColumnOrSuperColumn cosc = cassandra.get(stringSerializer.toByteBuffer("512204"),
- new ColumnPath("Npanxx").setColumn(ByteBufferUtil.bytes("city")), ConsistencyLevel.ONE);
- log.info("ColumnOrSuperColumn from thrift: {}", cosc);
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if ( pool != null)
- pool.releaseClient(client);
- }
- return null;
- }
-
-
-}

0 comments on commit 3768207

Please sign in to comment.