Façade pattern hides the complexities of the system, and provides a simpler interface to clients. Façade wraps a complicated subsystem with a simpler interface, and decouples the subsystems from its clients. Continue reading
Prototype Pattern
Prototype pattern implements a prototype interface which tells to create a clone of the current object. This pattern is used when creation of object directly is costly. Continue reading
How to Optimize Tomcat Performance
The default Tomcat configuration looks powerful and hassle-free to the 1st time users. However, it is not customized for the real work where high server load can be expected. Therefore, it is important to optimize Tomcat performance by setting customization and system tuning.
The post will describe how to optimize Tomcat performance. Continue reading
Identify Who Logged in Your Linux System
There are several methods to identify who logged in your Linux system. Continue reading
JBoss 8009 Port in Use BindException Fix
You may want multiple application servers to be deployed into the same server, for example one Tomcat 6/7, one JBoss Application Server 6.x, or three JBoss Application Servers. Assuming Tomcat 6.x is running, when you start JBoss AS 6.1, you might see JBoss 8009 Port in Use BindException in the jboss boot log: Continue reading
Abstract Factory Pattern
Abstract Factory Pattern provides an interface for creating a factory of related objects without explicitly specifying their classes. In other words, the Abstract Factory is a super-factory which creates other factories (Factory of factories). Continue reading
Difference between flush and commit in Hibernate
Session flush is the process of synchronizing the underlying persistent store with persistable state held in memory. Flushing the session simply gets the data in the session synchronized with the database. If a persisted object in the Session has value change, it becomes dirty, and Session flush will update the database in the running transaction, but it may not commit those changes. Continue reading
When and How to Use ThreadLocal in Java
What is ThreadLocal?
In Java, ThreadLocal has been used since JDK 1.2. In multi-threaded programming, there are multiple ways to achieve thread safety via synchronization / locks. ThreadLocal is a different way to achieve thread-safety by providing explicitly a copy of Object to each thread. Since the Object is not shared, there is no requirement of Synchronization. Therefore, it will help the application performance & system scalability improvement. Continue reading
Factory Pattern
Factory pattern is one of most used design pattern in Java, and it defines an interface to create the object without exposing the creation logic to the client, and has internal logic to decide which class to instantiate. Continue reading
Strategy Pattern
The intent of Strategy pattern is to define a family of algorithms, encapsulate each one, and make them interchangeable. Strategy lets a class behavior or its algorithm can be changed at run time. It captures the abstraction in an interface, and provides implementation details in derived classes. Continue reading