Skip to content

Commit

Permalink
Merge pull request #13 from jdanbrown/extract-zk-dep
Browse files Browse the repository at this point in the history
Extract ZooKeeperClient dependency [Thanks, jdanbrown!]
  • Loading branch information
C. Scott Andreas committed Aug 16, 2012
2 parents 3c4fa31 + 2549247 commit 555ff94
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main/scala/com/boundary/ordasity/Cluster.scala
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,16 @@ class Cluster(val name: String, val listener: Listener, config: ClusterConfig)
* Joins the cluster, claims work, and begins operation.
*/
def join() : String = {
join(None)
}

/**
* Joins the cluster using a custom zk client, claims work, and begins operation.
*/
def join(injectedClient: Option[ZooKeeperClient]) : String = {
state.get() match {
case NodeState.Fresh => connect()
case NodeState.Shutdown => connect()
case NodeState.Fresh => connect(injectedClient)
case NodeState.Shutdown => connect(injectedClient)
case NodeState.Draining => log.warn("'join' called while draining; ignoring.")
case NodeState.Started => log.warn("'join' called after started; ignoring.")
}
Expand Down

0 comments on commit 555ff94

Please sign in to comment.