Alex Rivera | Logout

How does Java's Dynamic Proxy actually work?

Asked 2009-04-23T12:47:42.513
11

I understand how to use Dynamic Proxies in Java but what I don't understand is how the VM actually creates a dynamic proxy. Does it generate bytecode and load it? Or something else? Thanks.

Edit
Report

1 Answer

5

I suggest that you read Dynamic Proxy Classes:

The Proxy.getProxyClass method returns the java.lang.Class object for a proxy class given a class loader and an array of interfaces. The proxy class will be defined in the specified class loader and will implement all of the supplied interfaces. If a proxy class for the same permutation of interfaces has already been defined in the class loader, then the existing proxy class will be returned; otherwise, a proxy class for those interfaces will be generated dynamically and defined in the class loader. [emphasis mine]

answered 2009-04-23T12:50:29.777

Your Answer