Today there are several tools that can be used to manipulate bytecode, ranging from very low-level tools such as ASM, which require you to work at the bytecode level, to high level frameworks such as CGlib, AspectJ, which allow you to write pure Java. Ofcourse each framework have there own limitations in creating proxies.
For the moment, I just want to provide a quick summary on the pros and cons of proxy frameworks available. Hope everyone knows about the GOFProxy design pattern.
JDK dynamic proxies:
The JDK dynamic Proxy relies heavily...
Ehcache 3.0 new API fundamentals
It’s been 5 years since Ehcache released Ehcache 2.0.Now Ehcache 3.0 is one of the most feature rich caching APIs out there.In the meantime while some caching solutions took very different approaches on it all, the expert group on JSR-107, Terracotta included, put great efforts in trying to come up with a standard API in 3.0.Below are the features introduced in Ehcache 3.0
1) Ehcache 3.0 will likely “extend” the specification of JSR-107.
2) Ehcache 2.0 constrain caches on-heap or on-disk.3.0 introduced more tiers to cache data in (off-heap, Terracotta...
Getting started with Ehcache 2.X with a simple demo.
Ehcache is an open-source, standards-based cache for boosting performance, offloading your database, and simplifying scalability. As a robust, proven, and full-featured solution, it is today’s most widely used Java-based cache. You can use Ehcache as a general-purpose cache or a second-level cache for Hibernate.
Here let me explaing how to use Ehcache with a simple mutithreading program.Lets start with dependencies required,Below are the depdendecies required to use Ehcache.
<dependency>
...
Creating Proxies Dynamically Using CGLIB Library with examples
CGLIB is a bytecode generation framework,there are many such frameworks which do same job.But CGLIB is high-level framework that would dynamically change classes providing its proxy and substituting the functionality of some methods.
Even JDK dynamic proxies can do same,but there are some cons in JDK proxies.JDK proxies will only work if your class is implemented from interface/s.Where as CGLIB does not have such restriction.It will create subclass(proxy) to any class.
CGLIB is a powerful, high performance code generation library, that relies...