1.1.3. Proxy Variations

From the book:

Proxy has several use cases:

  • Virtual proxy creates expensive objects on demand. An example is the LazyConnectionDataSourceProxy in the Spring Framework, which lazily creates the real JDBC DataSource when the first Statement is created.
  • Remote proxy provides a local representation of an object that sits in a different address space, for example on a remote machine. Note that the remote proxy does not have a real pointer to the remote object, but invokes the methods via RPC, RMI, Thrift, ProtoBuf, gRPC, REST, HTTP, TCP/UDP, or a different remoting mechanism.
  • Protection proxy controls access to the original object. This could be for access control or thread safety. An example is Collections.synchronizedCollection(), which returns a new Collection that is guarded against race conditions.


Complete and Continue  
Discussion

0 comments