org.objectweb.jac.aspects.distribution.consistency
Class StrongPullConsistencyWrapper

java.lang.Object
  extended byorg.objectweb.jac.core.Wrapper
      extended byorg.objectweb.jac.aspects.distribution.consistency.ConsistencyWrapper
          extended byorg.objectweb.jac.aspects.distribution.consistency.StrongPullConsistencyWrapper
All Implemented Interfaces:
Advice, ConstructorInterceptor, Interceptor, MethodInterceptor, Serializable

public class StrongPullConsistencyWrapper
extends ConsistencyWrapper

This wrapper class implements the core protocol for a strong consistency that is based on a pull strategy.

On contrary to the StrongPushConsistencyWrapper, this protocol pulls the data from the other replicas. Indeed, each time a data is read and is not locally available, it is fetched from the known replicas.

Author:
Renaud Pawlak
See Also:
StrongPushConsistencyWrapper, Serialized Form

Field Summary
 
Fields inherited from class org.objectweb.jac.aspects.distribution.consistency.ConsistencyWrapper
ALL_GETTERS, ALL_METHODS, ALL_MODIFIERS, knownReplicas, visitedReplicas
 
Fields inherited from class org.objectweb.jac.core.Wrapper
ac, cr
 
Constructor Summary
StrongPullConsistencyWrapper(AspectComponent ac)
          An empty constructor for the Consistency class.
StrongPullConsistencyWrapper(AspectComponent ac, String hosts)
          A friendly constructor for a pull consistency wrapper.
 
Method Summary
 Object acceptRemoteRead(Wrappee wrappee, RemoteRef remoteReplica, Object[] data)
          Try to read the method asked by whenRead.
 Object whenRead(Interaction interaction)
          This wrapping method first try to use the wrappee to get the result of the read method.
 
Methods inherited from class org.objectweb.jac.aspects.distribution.consistency.ConsistencyWrapper
acceptRemoteCall, acceptRemoteWrite, addKnownReplica, addMember, construct, expandMethods, getConsistencyWrapperType, getKnownReplicas, getVisitedReplicas, invalidateTopology, invoke, setCallMethods, setKnownReplicas, setReadMethods, setWriteMethods, toString, whenBindingNewReplica, whenCall, whenNewReplicaBounded, whenWrite, wrap
 
Methods inherited from class org.objectweb.jac.core.Wrapper
attr, attrdef, defines, getAspectComponent, getAspectComponentName, getExceptionHandlers, proceed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StrongPullConsistencyWrapper

public StrongPullConsistencyWrapper(AspectComponent ac,
                                    String hosts)
A friendly constructor for a pull consistency wrapper.

Parameters:
hosts - a regular expression that defines the host where the consistency protocol is installed

StrongPullConsistencyWrapper

public StrongPullConsistencyWrapper(AspectComponent ac)
An empty constructor for the Consistency class.

Method Detail

whenRead

public Object whenRead(Interaction interaction)
This wrapping method first try to use the wrappee to get the result of the read method.

If this result is null or if an exception occurs, it considers that the read information was not locally present and tries to fetch it from the replicas it knows (recursivelly all the replicas are finally asked). If none of the replica returns a value, it returns null or throws an exception.

Overrides:
whenRead in class ConsistencyWrapper
Returns:
the value returned by the wrapped read method
See Also:
ConsistencyWrapper.acceptRemoteRead(Wrappee,RemoteRef,Object[])

acceptRemoteRead

public Object acceptRemoteRead(Wrappee wrappee,
                               RemoteRef remoteReplica,
                               Object[] data)
Try to read the method asked by whenRead.

The data is :

Overrides:
acceptRemoteRead in class ConsistencyWrapper
Parameters:
remoteReplica - the replica that received the read event
data - the read event data
Returns:
the return value of the data[0] method
See Also:
ConsistencyWrapper.whenRead(Interaction)