Example to implement a distributed lock service using java.