Created
November 14, 2011 22:48
-
-
Save smanek/1365466 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
final int port = 2182; | |
final EmbeddedZookeeperServer server = EmbeddedZookeeperServer.builder().clientPort(port).build(); | |
final RobustZooKeeper client = new RobustZooKeeper("localhost:" + port); | |
client.withLock("lockName", | |
new Runnable() { | |
@Override | |
public void run() { | |
System.out.println("I've got the lock while I'm running!"); | |
} | |
}); | |
client.shutdown(); | |
server.shutdown(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment