org.objectweb.jac.core.dist
Class NonBlockingStubWrapper

java.lang.Object
  extended byorg.objectweb.jac.core.Wrapper
      extended byorg.objectweb.jac.core.dist.StubWrapper
          extended byorg.objectweb.jac.core.dist.NonBlockingStubWrapper
All Implemented Interfaces:
Advice, ConstructorInterceptor, Interceptor, MethodInterceptor, Serializable

public class NonBlockingStubWrapper
extends StubWrapper

NonBlockingStubWrapper is a dynamic client stub for org.objectweb.jac. Every method called on an object wrapped by such a wrapper is forwarded to a remote reference. The call is non blocking. For blocking calls see StubWrapper. This a wrapper class. The invoke method wraps all the methods of a wrappee.

Author:
Lionel Seinturier
See Also:
StubWrapper, Serialized Form

Field Summary
protected  int firstFreeCell
          Index of the 1st free cell in results.
protected static int nbMaxOfResults
          Maximum number of results stored.
protected  Object[] results
          Mailbox for results received from asynchonous calls.
 
Fields inherited from class org.objectweb.jac.core.dist.StubWrapper
remoteRef
 
Fields inherited from class org.objectweb.jac.core.Wrapper
ac, cr
 
Constructor Summary
NonBlockingStubWrapper(AspectComponent ac, RemoteRef remoteRef)
          Construct a new dynamic stub.
NonBlockingStubWrapper(AspectComponent ac, String serverContainer)
          A more user-friendly constructor.
 
Method Summary
 Object getResult(Integer index)
          Return the requested result.
 Object invoke(Interaction interaction)
          Forward a call to the remote reference.
 void setFirstFreeCell()
           
 
Methods inherited from class org.objectweb.jac.core.dist.StubWrapper
_invoke, construct, getRemoteRef, invoke
 
Methods inherited from class org.objectweb.jac.core.Wrapper
attr, attrdef, defines, getAspectComponent, getAspectComponentName, getExceptionHandlers, proceed, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

nbMaxOfResults

protected static final int nbMaxOfResults
Maximum number of results stored. The idea is that if nbMaxOfResults consecutive calls have been made, the probability that the initial result is to be required is low.

See Also:
Constant Field Values

results

protected Object[] results
Mailbox for results received from asynchonous calls. The array is managed as a circular list.


firstFreeCell

protected int firstFreeCell
Index of the 1st free cell in results.

Constructor Detail

NonBlockingStubWrapper

public NonBlockingStubWrapper(AspectComponent ac,
                              RemoteRef remoteRef)
Construct a new dynamic stub.

Parameters:
remoteRef - the remote reference associated to the stub

NonBlockingStubWrapper

public NonBlockingStubWrapper(AspectComponent ac,
                              String serverContainer)
A more user-friendly constructor.

Parameters:
serverContainer - the name of the container where the server is deployed
Method Detail

invoke

public Object invoke(Interaction interaction)
Forward a call to the remote reference.


setFirstFreeCell

public void setFirstFreeCell()

getResult

public Object getResult(Integer index)
Return the requested result.

Parameters:
index - the result index
Returns:
the requested result