Tuesday, 15 March 2011

Basics of Java's Garbage Collection

Garbage collection:

Every java program runs as a process and is allocated some memory. The memory allocated to the java process is called process heap.

The java heap i.e. the java object heap, is part of the process heap. The java object heap (also called just java heap) store the java objects i.e. object instances. The java heap can be configured using the several command line parameters.

Garbage collection is the mechanism used by java to reclaim or recollect the space occupied by objects that are not reachable from the program. This is necessary to ensure that the application does not run out of memory.

Friday, 4 March 2011

Custom error page for your grails application

I recently added a custom error page to my application, so that the users don't see the stacktrace and are shown a friendly message in case of a runtime error.

Thursday, 3 March 2011

Get started with Spring JMS using ActiveMQ

Messaging is a mechanism to create and exchange data/information/objects within/between applications. An application that generates some useful data can send it's messages (objects) to an agent and these messages (objects) can then be read from another application. JMS is a Java API that enables applications to be able to communicate with each other using the mechanism described above.

You can read more about JMS here.

In this article, we will see how you can quickly start using JMS using the Spring JMS framework. Spring provides template based APIs which greatly simplify the use of JMS. A lot of work is done behind the scenes which saves the developer time to concentrate on the business requirement.

We will take a look at the important Spring JMS classes and apis as we go through an example. So let's get started!