Class ProxyLoader

java.lang.Object
gnu.cajo.utils.ProxyLoader
All Implemented Interfaces:
Invoke, Serializable, Remote

public final class ProxyLoader extends Object implements Invoke
This class is used to avoid having to load proxies into the VM runtime of the proxy server. This is useful in the case when proxies are large, or are not directly referenced by the server before sending them to the client. This is extremely helpful when the server provides a large number of proxies. This wrapper object requires only a small number of bytes in the server's VM, to represent a proxy object of arbitrary size. Upon its arrival at the hosting VM, it will reconstruct the internally referenced proxy object, either by construction or deserialization, and initialize it such that any proxy object can be handled via this class. This will also conserve bandwidth, as proxies in the codebase jar file are compressed.

Typical serialized proxy names: /test.ser /objects/test.ser

Typical unserialized proxy names: Test classes/Test

Version:
1.0, 01-Nov-99 Initial release
See Also:
  • Field Details

  • Constructor Details

    • ProxyLoader

      public ProxyLoader(String handle)
      The constructor creates a small wrapper object referencing a proxy object solely by name, but not loading its object into the server's VM runtime. It is simply a server-side representation of the proxy, but not the proxy itself.
      Parameters:
      handle - The path of either the proxy class file, or the file containing serialized instance of the proxy, to be found inside the proxy's codebase jar file.
  • Method Details

    • invoke

      public Object invoke(String method, Object args) throws Exception
      This function may be called reentrantly, so the inner object must synchronise its critical sections as necessary. Its first invocation is performed by the ItemServer, to provide a remote reference to itself, for proxy callbacks. The second invocation is by the client, to provide a remoted reference to the ProxyLoader, to allow the proxy a handle on which to receive asynchronous callbacks. At this point the ProxyLoader will reconstitute the proxy object, and pass it the two previous arguments, respectively. All subsequent invocations are routed directly to the created proxy itself.
      Specified by:
      invoke in interface Invoke
      Parameters:
      method - The method to invoke on the internal object.
      args - The arguments to provide to the method for its invocation. It can be a single object, an array of objects, or null.
      Returns:
      The sychronous data, if any, resulting from the invocation.
      Throws:
      RemoteException - For network communication related reasons.
      NoSuchMethodException - If no matching method can be found.
      Exception - If the internal object rejects the request, for any application specific reason.
    • toString

      public String toString()
      This method is used to identify the contents of the ProxyLoader. It returns the value stored in the handle member variable. This is primarily intended to assist in debugging.
      Overrides:
      toString in class Object
      Returns:
      The path and filename of the proxy resource, either class or object.