Posts

Showing posts with the label objectstream

All you need to know about JSON Processing in JEE7

JSON is the choice data transfer format used all RESTful services because it is light weight, open standard, less verbose and easy to understand. One of the most important factor for all current generation services is performance and JSON format satisfies all such needs. There are already few third party Java APIs available to JSON parsing but with growing popularity, JEE introduced new JSON processing 1.0 API as part of JSR-353. This API supports both object model as well as streaming model for processing JSON, which are similar to those used for XML documents.This API is limited to JSON processing but not binding, JSON-binding framework will be available in subsequent version of JEE. Object vs Streaming Model : The object model creates a tree that represents the JSON data in memory. The tree can then be navigated, analyzed, or modified. This approach is the most flexible and allows for processing that requires access to the complete contents of the tree. However, it is often sl...

Serializable Singleton Class

Previously I have posted about Singleton Design Pattern implementation and handling concurrency . In this post I am going to explains challenges for serializable Singleton class. Lets know about Singleton Class ( Single Design Pattern), A Singleton class restricts access to its constructor to ensure that only a single instance is ever created. I have taken example from previous post only   1: /** 2: * Singleton Class 3: * 4: * @author ydevatra 5: * 6: */ 7: public class SingletonResource implements Serializable { 8:   9: /* Private instance reference */ 10: private static SingletonResource resource = new SingletonResource(); 11:   12: /** 13: * Private constructor to restrict creation of instance of this class by 14: * other class. 15: */ 16: private SingletonResource() { 17: // Initialization code... 18: } 19:   20: ...