Whenever you work with Enterprise or Spring beans, mocked instances, and implement AOP, make RMI or JNI calls to another object with the same interface, or directly/indirectly use java.lang.reflect.Proxy, there is a proxy object involved. Its purpose is to provide a surrogate for a real object, with exactly the same footprint. It delegates the work to it while doing something else before or after the call. Types of proxy include the following:
- Remote proxy: This delegates the work to a remote object (different process, different machine), an Enterprise bean, for example. Wrapping existing non-Java old code (for example, C/C++) by using JNI, either manually or automatically (for example, by using SWIG to generate the glue code—see http://www.swig.org/Doc1.3/Java.html#imclass ), is a form of a remote proxy pattern, since it uses a handle (pointer in C/C++)...