Package gnu.cajo.utils
Class ProxyLoader
java.lang.Object
gnu.cajo.utils.ProxyLoader
- All Implemented Interfaces:
Invoke
,Serializable
,Remote
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 Summary
FieldsModifier and TypeFieldDescriptionprivate final String
private Object
private static final long
private RemoteInvoke
-
Constructor Summary
ConstructorsConstructorDescriptionProxyLoader
(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
-
Field Details
-
serialVersionUID
private static final long serialVersionUID- See Also:
-
handle
-
server
-
proxy
-
-
Constructor Details
-
ProxyLoader
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
This function may be called reentrantly, so the inner object must synchronise its critical sections as necessary. Its first invocation is performed by theItemServer
, 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 interfaceInvoke
- 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
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.
-