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

java.lang.Object
  |
  +--org.objectweb.jac.core.Wrapper
        |
        +--org.objectweb.jac.aspects.distribution.consistency.ConsistencyWrapper
              |
              +--org.objectweb.jac.aspects.distribution.consistency.WeakConsistencyWrapper
All Implemented Interfaces:
Advice, ConstructorInterceptor, Interceptor, MethodInterceptor, Serializable

public class WeakConsistencyWrapper
extends ConsistencyWrapper

This wrapper class implements a weak consistency protocol for a set of replicas.

The semantics of this protocol is that the readed data can be inconsistent with the other replicas. When a write event occurs, the currently written replicas asks for the consistent state to the valid replica (the owner) and becomes itself the valid replica. This protocol ensures that the set of modifications are finally done in at least one replica.

Author:
Renaud Pawlak
See Also:
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
WeakConsistencyWrapper(AspectComponent ac)
           
 
Method Summary
 Object acceptRemoteWrite(Wrappee wrappee, RemoteRef remoteReplica, Object[] data)
          The current object is not the owner anymore and returns the object state so that the new owner can be consistent
 Object setOwner(RemoteRef newOwner)
          This role method sets a new owner.
 Object whenWrite(Interaction interaction)
          Update the wrappee state with the owner replica state before proceeding the writing method.
 
Methods inherited from class org.objectweb.jac.aspects.distribution.consistency.ConsistencyWrapper
acceptRemoteCall, acceptRemoteRead, addKnownReplica, addMember, construct, expandMethods, getConsistencyWrapperType, getKnownReplicas, getVisitedReplicas, invalidateTopology, invoke, setCallMethods, setKnownReplicas, setReadMethods, setWriteMethods, toString, whenBindingNewReplica, whenCall, whenNewReplicaBounded, whenRead, 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

WeakConsistencyWrapper

public WeakConsistencyWrapper(AspectComponent ac)
Method Detail

whenWrite

public Object whenWrite(Interaction interaction)
Update the wrappee state with the owner replica state before proceeding the writing method.

The wrappee then becomes the owner.

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

acceptRemoteWrite

public Object acceptRemoteWrite(Wrappee wrappee,
                                RemoteRef remoteReplica,
                                Object[] data)
The current object is not the owner anymore and returns the object state so that the new owner can be consistent

Overrides:
acceptRemoteWrite in class ConsistencyWrapper
Parameters:
remoteReplica - the replica that is beeing written
data - this parameter is not used in this protocol (its value is null)
Returns:
the state of the object so that the written object can become a consistent owner
See Also:
ConsistencyWrapper.whenWrite(Interaction)

setOwner

public Object setOwner(RemoteRef newOwner)
This role method sets a new owner.

Parameters:
newOwner - a remote reference on the new owner
Returns:
null