Archive | Java

23 November 2009 ~ 1 Comment

Getting Started with Terracotta

Abstract
In this small post we shall explore Terracotta, a leading pure Java Scalability platform. The discussion is based on the AtomicInteger example from Terracotta site, which shows how to implement a Cluster wide id generator (Actually it’s the Sequencer example, but to keep my steps simple had used AtomicInteger). The reason why I choose this [...]

Continue Reading

29 September 2009 ~ 1 Comment

Executors in Action - Part 1 - The Life cycle

From the Javadoc
… interface provides a way of decoupling task submission from the mechanics of how each task will be run, including details of thread use, scheduling, etc. An Executor is normally used instead of explicitly creating threads.
Indeed, Executors provide a more robust and easy mechanism for decoupling of submitting a task, from its execution.
In [...]

Continue Reading

02 August 2009 ~ 28 Comments

If-else vs switch – Which is better?

“Use switch instead of if-else, its more readable and has better performance.” I have to admit that this was one of my favorite code review comment. Until one fine day, while hacking Apache Sanselan’s image format decoding function, I tried optimizing the code based on the same comments and while benchmark there was hardly any [...]

Continue Reading