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[…]

Sometimes you have a class containing an id of another (lets say a Machine class containing an owner id rather than an Owner object). The owner id is actually a primary key from the Owner table in the database. Now you want to display the Machine class in a wicket form with a dropdown to select the Owner. In an ideal world, your Machine class would have “Owner getOwner()” and “setOwner (Owner owner)” methods and your MachineService class would have a static “List getOwners()” method and wicket’s DropDownChoice would just work with: [sourcecode language=”java”] final Form form = new Form(“form”, new CompoundPropertyModel(machine)); add(form); form.add(new DropDownChoice(“owner”, MachineService.getOwners())); [/sourcecode] However, in our Machine class, the owner property is an id of an[…]