Skip to content

Instantly share code, notes, and snippets.

@malexejev
Created March 15, 2013 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save malexejev/5170342 to your computer and use it in GitHub Desktop.
Save malexejev/5170342 to your computer and use it in GitHub Desktop.
package com.xxx.metadata.hector;
import me.prettyprint.cassandra.connection.client.HClient;
import me.prettyprint.cassandra.connection.factory.HThriftClientFactoryImpl;
import me.prettyprint.cassandra.service.CassandraHost;
import me.prettyprint.cassandra.service.CassandraHostConfigurator;
/**
* Custom client factory for use in {@link CassandraHostConfigurator}.
* Works by wrapping internally generated Thrift client with {@link HVersionEnforcingClient}.
*
* @author Max Alexejev
* Mar 13, 2013
*/
public class HVersionEnforcingClientFactory extends HThriftClientFactoryImpl {
public static final String CQL_VERSION = "3.0.0";
@Override
public HClient createClient(CassandraHost ch) {
return new HVersionEnforcingClient(super.createClient(ch), CQL_VERSION);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment