Class ProxyLoader

  • All Implemented Interfaces:
    Invoke, java.io.Serializable, java.rmi.Remote

    public final class ProxyLoader
    extends java.lang.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:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      ProxyLoader​(java.lang.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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object invoke​(java.lang.String method, java.lang.Object args)
      This function may be called reentrantly, so the inner object must synchronise its critical sections as necessary.
      java.lang.String toString()
      This method is used to identify the contents of the ProxyLoader.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • handle

        private final java.lang.String handle
      • proxy

        private transient java.lang.Object proxy
    • Constructor Detail

      • ProxyLoader

        public ProxyLoader​(java.lang.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 Detail

      • invoke

        public java.lang.Object invoke​(java.lang.String method,
                                       java.lang.Object args)
                                throws java.lang.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:
        java.rmi.RemoteException - For network communication related reasons.
        java.lang.NoSuchMethodException - If no matching method can be found.
        java.lang.Exception - If the internal object rejects the request, for any application specific reason.
      • toString

        public java.lang.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 java.lang.Object
        Returns:
        The path and filename of the proxy resource, either class or object.