Hazelcast (hazelcast.com) provides an easy way to implement distributed locking to allow your applications to run multiple, fault-tolerant instances without worrying about issues related concurrent access to shared resources (like files, databases or whatever). [sourcecode language=”java”] try { java.util.concurrent.locks.Lock lock = Hazelcast.getLock(“mylock”); while (true) { lock.lock(); try { // do some work involving access to shared resources } finally { lock.unlock(); } } } finally { Hazelcast.shutdown(); } [/sourcecode] We have an SMS server which retrieved mail messages from a POP3 mailbox, entered them to a database and then delivered via the Clickatell messaging gateway. Making it run multiple instances concurrently would have been a headache since it would involve various issues relating to transactions across the POP3 and the[…]