private static class RemoteObject.RemoteAccess extends InvocationStub
Modifier and Type | Class and Description |
---|---|
private class |
RemoteObject.RemoteAccess.Invoker
Helper class to delegate execution of the
transact
method. |
Modifier and Type | Field and Description |
---|---|
private HighLevelObject |
hlo
Remote invocation helper.
|
private java.util.Map<java.lang.reflect.Method,RoutingKey> |
keylist
Routing key cache mapped by method object.
|
private boolean |
tracing
Tracing flag.
|
Constructor and Description |
---|
RemoteAccess(Session session,
int timeout)
Creates a unique instance of an object that can handle invocations
of any proxied method by redirecting the method calls to a remote
node's exported API and returning the result or throwing any
exceptions as needed.
|
Modifier and Type | Method and Description |
---|---|
private boolean |
hierarchyDeclaresMethod(java.lang.reflect.Method method,
java.lang.Class<?> iface)
Determine whether the given interface or any of its ancestors
declare the given method.
|
java.lang.Object |
invokeCore(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
This method acts as an interceptor which is called every time a
method of the proxy object is invoked.
|
private RoutingKey |
obtainRoutingKey(java.lang.reflect.Method method,
java.lang.Object proxy)
Gets the routing key associated with a specific method.
|
java.lang.Object |
trace(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args,
RoutingKey key)
Tracing worker that handles the remote method call to the exported
interface (over the network to the other node) and logs when the call
is made (at FINER level) and logs parameters, return values and an
elapsed time in millis (at FINEST level).
|
invoke
private java.util.Map<java.lang.reflect.Method,RoutingKey> keylist
private HighLevelObject hlo
private boolean tracing
RemoteAccess(Session session, int timeout)
session
- The network connection which the returned object should
represent. Must not be null
.timeout
- Timeout in milliseconds for synchronous transactions to
wait before automatically unblocking. Use 0 to set an
indefinite wait.public java.lang.Object invokeCore(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws java.lang.Throwable
invokeCore
in class InvocationStub
proxy
- Proxy object upon which the intercepted method is invoked.method
- Method to be invoked through reflection.args
- Arguments, if any, to method
.java.lang.Throwable
- if an exception/error occurs upon the invocation target,
or if any problem occurs during pre- or post-processing.public java.lang.Object trace(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args, RoutingKey key) throws java.lang.Throwable
proxy
- Proxy object upon which the intercepted method is invoked.method
- Method to be invoked through reflection.args
- Arguments, if any, to method
.key
- The routing key used for the remote method invocation.java.lang.Throwable
- If an exception/error occurs upon the invocation target,
or if any problem occurs during pre- or post-processing.private RoutingKey obtainRoutingKey(java.lang.reflect.Method method, java.lang.Object proxy)
method
- The method for which the key must be obtained.private boolean hierarchyDeclaresMethod(java.lang.reflect.Method method, java.lang.Class<?> iface)
method
- Method to search for.iface
- Interface whose inheritance hierarchy is to be searched.true
if iface
or any of its
ancestor superinterfaces declares method
, else
false
.