// archives

Archive for March, 2010

Java Tip: How to use Java Timer to synchronize multiple repeating tasks

Recently I had to implement a service that involved multiple nodes in a cluster to aggregate the data for certain period of time and report it back to the central server. The central server, then aggregated results provided by all the nodes in the cluster. This required all the nodes to align properly when reporting the aggregate data to the central.

For example, if the system was configured to aggregate data for 10 minutes, each node in the cluster was expected to send the aggregate data, every 10th minute beginning at the top of the hour. In this case, the central server was expecting data from all the nodes at 10:00 am, 10:10 am, 10:20 am, 10:30 am and so on. The node started at 10:05:15 am was expected to report its aggregate data at 10:10:00 am and every 10th minutes after that (instead of 10 minutes after the node is started and every 10 minutes after that).

Starting web development with Maven and Eclipse

Before you begin

  1. Install Apache Maven 2.2.x
  2. Install Eclipse (preferably 3.5.x version or later)
  3. Install Maven plugin for Eclipse
  4. Configure Maven plugin by going to Windows -> Preferences -> Maven. Add and use your external maven installation instead of embedded version.