Skip to content

Instantly share code, notes, and snippets.

@cscotta
Created October 20, 2011 16:49
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 cscotta/1301632 to your computer and use it in GitHub Desktop.
Save cscotta/1301632 to your computer and use it in GitHub Desktop.
import com.yammer.metrics.Meter
import com.twitter.zookeeper.ZooKeeperClient
import com.boundary.ordasity.{Cluster, ClusterConfig, SmartListener}
class MyService {
val config = new ClusterConfig("localhost:2181")
val cluster = new Cluster("ServiceName", listener, config)
val listener = new SmartListener {
// Called after successfully joining the cluster.
def onJoin(client: ZooKeeperClient) { }
// Do yer thang, mark that meter.
def startWork(workUnit: String, meter: Meter) { }
// Stop doin' that thang.
def shutdownWork(workUnit: String) { }
// Called after leaving the cluster.
def onLeave() { }
}
cluster.join()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment