More often than not you need your java program to perform an operation at a particular time. It gets trickier when the operation needs to be performed at regular intervals. There are a lot of solutions to implement a java “cron” of sorts available. There’s the quartz scheduler which has pretty much everything that you will ever need in terms of scheduling, then there’s Spring TaskExecutor’s which can do pretty much everything but are a lot easier to configure than a full blown job scheduler.
(more…)
Archive for January, 2009
Java job scheduling and cron
Saturday, January 31st, 2009Monitoring spring based applications including hibernate statistics using JMX
Saturday, January 31st, 2009Spring Framework is by the most versatile framework for java applications. It can be used with any kind of application, be it an applet, a swing app or a web application.
Spring transaction management is one of the most powerful features of spring. It manages your transactions for you with minimal code, infact all you need to do is put a few lines of code in your configuration file and then annotate your classes/methods with the @Transactional annotation. Combining this with ORM tools such as hibernate, what you have is full fledged transaction management running in under 5 minutes.
(more…)
Difference/Comparison between/of Serializable and Externalizable
Friday, January 30th, 2009I’m asked the difference between the two interfaces, Serializable and Externalizable more often than i’d like. It’s pretty simple really. Serializable does all the dirty work for you, it writes the object to the output stream on it’s own without you having to bother about anything at all. Externalizable on the hand makes you do ALL the work. You must handle the reading and writing on your own.
The easiest difference to remember is the methods to be implemented by the class. That information can be easily obtained from the javadocs.
The major difference however, the one most people miss, is that the default no-arg constructor is called during the reconstruction of an object who’s class implements the Serializable interface. However, this call is not made for a class which implements the Externalizable interface.
Hope that helps.