Skip to content

Commit

Permalink
[split] Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit 38d83431735bd542ff20fd80ac40dd2035fd25cd
Merge: 1433984 ad396f5
Author: Matthew Bilotti <mbilotti@twitter.com>
Date:   Tue Jan 17 16:23:53 2012 -0800

    Merge branch 'master' of https://git.twitter.biz/birdcage into cassie_serversets_add_constructor

commit 1433984ea1524452eee161d6013496042aba6b9b
Author: Matthew Bilotti <mbilotti@twitter.com>
Date:   Tue Jan 17 15:03:57 2012 -0800

    add a ServerSetsCluster constructor that accepts a ZooKeeperClient instance
  • Loading branch information
Matthew Bilotti committed Jan 18, 2012
1 parent dacfbde commit d4c9885
Showing 1 changed file with 15 additions and 5 deletions.
Expand Up @@ -32,19 +32,29 @@ class ZookeeperServerSetCCluster(serverSet: ServerSet) extends ZookeeperServerSe
* val keyspace = cluster.keyspace(keyspace).connect()
*
*
* @param zkAddersses list of some ZooKeeper hosts
* @param zkClient existing ZooKeeperClient
* @param zkPath path to node where Cassandra hosts will exist under
* @param timeoutMillis timeout for ZooKeeper connection
* @param stats a finagle stats receiver
*/
class ServerSetsCluster(zkAddresses: Iterable[InetSocketAddress], zkPath: String, timeoutMillis:
Int, stats: StatsReceiver = NullStatsReceiver) extends ClusterBase {
class ServerSetsCluster(zkClient: ZooKeeperClient, zkPath: String, stats: StatsReceiver) extends ClusterBase {

/**
* Convenience constructor that creates a ZooKeeperClient using the specified hosts and timeout.
*
* @param zkAddresses list of some ZooKeeper hosts
* @param zkPath path to node where Cassandra hosts will exist under
* @param timeoutMillis timeout for ZooKeeper connection
* @param stats a finagle stats receiver
*/
def this(zkAddresses: Iterable[InetSocketAddress], zkPath: String, timeoutMillis: Int,
stats: StatsReceiver = NullStatsReceiver) =
this(new ZooKeeperClient(Amount.of(timeoutMillis, Time.MILLISECONDS), JavaConversions.asJavaIterable(zkAddresses)), zkPath, stats)

/**
* Returns a [[com.twitter.cassie.KeyspaceBuilder]] instance.
* @param name the keyspace's name
*/
def keyspace(name: String): KeyspaceBuilder = {
val zkClient = new ZooKeeperClient(Amount.of(timeoutMillis, Time.MILLISECONDS), JavaConversions.asJavaIterable(zkAddresses))
val serverSet = new ServerSetImpl(zkClient, zkPath)
val cluster = new ZookeeperServerSetCCluster(serverSet)
KeyspaceBuilder(cluster, name, stats.scope("cassie").scope(name))
Expand Down

0 comments on commit d4c9885

Please sign in to comment.