Created
October 20, 2011 16:49
-
-
Save cscotta/1301632 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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