DistributedLock lock = new DistributedLock("/locks/lock1");
lock.lock();
try {
// ...
} finally {
lock.unlock();
}
DistributedQueue queue = new DistributedQueue("/queues/queue1");
queue.offer("message1");
queue.offer("message2");
String message = queue.poll();