Search This Blog

Monday, 24 February 2014

Reference Queues

In the previous posts we had a look at weak and soft references. The java.lang.ref package also includes a class ReferenceQueue. As per the class documentation:
Reference queues, to which registered reference objects are appended by the garbage 
collector after the appropriate reachability changes are detected.

Tuesday, 18 February 2014

Soft References in Java

In the last post I looked at using weak references in my java code. As we saw Java has not just strong and weak but also soft and phantom references.
Firstly, what are soft references ?

Sunday, 9 February 2014

Weak References in Java

I have been looking at the java.lang.ref package with a view to understanding references in java. It all started when I tried to understand WeakHashMap and its use in string pools. The various related terms mentioned totally flummoxed me and made some additional study essential. Below is a summary of my attempts at understanding.
Java objects in the memory are classified as:

Sunday, 2 February 2014

Views in ModelAndView

We had an interesting scenario in our code. It all started out when we had this complex controller that included methods specific to a certain flow. In case of any exception, we used an error handler to redirect the flow to an error page. The code would be along the lines of