org.openrdf.util.rmirouting
Class ChannelIfaceInvocation
java.lang.Object
org.openrdf.util.rmirouting.ChannelIfaceInvocation
- All Implemented Interfaces:
- InvocationHandler
- public class ChannelIfaceInvocation
- extends Object
- implements InvocationHandler
The implementation of client side wraper used to handle and then pass the
method invocation requests to the remote side of the channel.
we should notice that all 'void' methods that have only native or Serailizable arguments
could be batched and passed at once at some future moment. This can be enable if the wrapped instance
implements a Bachable Interface.
The rationale behind this is the assumption that such methods cannot change, in any other way,
the state of the invoking context unless they has some very important and significant side effects implemented.
- Version:
- 1.0
- Author:
- Damyan Ognyanoff
|
Method Summary |
Object |
invoke(Object proxy,
Method method,
Object[] args)
Handle instance method invocations. |
Object |
invoke(Object method,
Object[] args)
a helper which sends the method invocation requests to the remote instance
and try to resiolve the return value to some locally stubbed object.
|
static Object |
wrapIt(Object o)
A static method used to wrap an remote ref ot an instance. |
ChannelIfaceInvocation
public ChannelIfaceInvocation(ChannelIface remote,
boolean bCanBatch)
- the only constructor
- Parameters:
remote - - an instance to which all the 'invoke's are directedbCanBatch - indicate while to suspend the method batching for that
particular instance. It is set to false by the presence of NotBatchable interface
into the list of implemented interfaces by the remote instance which is subject of wrapping
wrapIt
public static Object wrapIt(Object o)
throws Exception
- A static method used to wrap an remote ref ot an instance. Only remote refs implementing
ChannelIface
will be wrapped
- Parameters:
o - is the ref to be wrapped
- Returns:
- an wraped instance
- Throws:
Exception
invoke
public Object invoke(Object method,
Object[] args)
throws Throwable
- a helper which sends the method invocation requests to the remote instance
and try to resiolve the return value to some locally stubbed object.
This is neccessary because we like to avoid multiple wrappings around such objects
- Parameters:
method - is the description of the method being invokedargs - are the arguments passed to the method
- Returns:
- thre value returned by the ral method
- Throws:
Throwable - if some exception occur. it will be wrapped into an RemoteException
this way, later, we'll be able to get it's 'cause' and rise it locally.
All this is an attempt to mimic the remote object's behaviour into the local
context from where the method invocaation were originated.
invoke
public Object invoke(Object proxy,
Method method,
Object[] args)
throws Throwable
- Handle instance method invocations. Here we describe th einvoked method so to be
uniquely indentified on th eother side. This description is constructed from
the name of the method being invoked followed by the names of the classes of its arguments.
The delimiter used to separate these values is '|' character. Once constructed it is
coverted to char array - to somehow reduce the net traffic a bit.
- Specified by:
invoke in interface InvocationHandler
- Parameters:
proxy - - unused here because we like to invoke an remote instance's methodmethod - - a method being invokedargs - are th earguments passed for the call
- Returns:
- is what the real method returns from the call.
- Throws:
Throwable - it is the exception rised wrom the other side. It is good to use
fully serializable exceptions because, if not, they couldn't be transported here at all.
Copyright © 2002-2006 Aduna BV, GNU LGPL License applies.