XML Unmarshalling in Java: JAXB vs STax vs Woodstox

What is XML Unmarshalling?

Marshalling is the process of transforming the memory representation of an object to a data format suitable for storage or transmission, and it is typically used when data must be moved between different parts of a computer program or from one program to another. Marshalling is similar to serialization and is used to communicate to remote objects with an object, in this case a serialized object. It simplifies complex communication, using custom/complex objects to communicate instead of primitives. The opposite, or reverse, of marshalling is called unmarshalling (or demarshalling, similar to deserialization). 

Read More

Memory Leaks - Spend Your Memory Wisely !

n computer science, a memory leak is a particular kind of unintentional memory consumption by a computer program where the program fails to release memory when no longer needed. When a memory leak occurs, memory is not physically lost from the computer, but rather becomes claimed but ignored due to program logic flaws. When we are allocating memory using new or malloc and then failing to deallocate the memory after its use within the application’s life span, then the memory allocated earlier will become unusable for the application, there by making it a leak in the memory.

Read More

Sorting Huge Files Using Java

Howdy all. In this post, I will share some of my monkey coding work that can concurrently sort very huge files in relatively less time.

Goal: Sort an extremely large text file using java.

How it works:

  1. Take the target text file
  2. Split it into multiple say ‘n’ small chunks
  3. Feed each chunk of these files to each of the 'n’ asynchronous threads for sorting
  4. Merge the sorted files into one (TBI) 
Read More

Unix File Monitor

Well, I recently came across a situation at my work place where various teams have a common shared space to keep some configuration files and there is no proper synchronization between the teams, some one messes up with the files - every one has to suffer and we used to end up not knowing the last person who accessed the common directory. So, one of my colleagues asked me if I can write a simple monitoring script and I ended up with this which uses unix file stats to detect the change and mails the ip address of the users who even touches the directory:

Read More