JAC project
AOPSYS
CEDRIC & LIP6 labs

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

java.lang.Object
  |
  +--org.objectweb.jac.core.Wrapper
        |
        +--org.objectweb.jac.aspects.distribution.consistency.ConsistencyWrapper
              |
              +--org.objectweb.jac.aspects.distribution.consistency.StrongPushConsistencyWrapper
All Implemented Interfaces:
Serializable

public class StrongPushConsistencyWrapper
extends ConsistencyWrapper

This wrapper implements a consistency protocol that forwards all the writing calls to all the replicas that are known by the wrapper.

It is called "push" since the wrapper pushes the data to the other replicas. Despite this strategy is the most curently used, other strong or weak consistency strategies can be implemented by other consistency wrappers.

Author:
Renaud Pawlak
See Also:
whenWrite(Interaction), StrongPullConsistencyWrapper, WeakConsistencyWrapper, 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
 
Constructor Summary
StrongPushConsistencyWrapper(AspectComponent ac)
          An empty constructor for the Consistency class.
StrongPushConsistencyWrapper(AspectComponent ac, String hosts)
          A friendly constructor for a push consistency wrapper.
 
Method Summary
 Object acceptRemoteWrite(Wrappee wrappee, RemoteRef remoteReplica, Object[] data)
          This method is called by whenWrite to push the needed data when a state is writen in a remote replica.
 void whenBindingNewReplica(Wrappee wrappee, RemoteRef newReplica)
          Push the current replica state to the binding new replica.
 Object whenWrite(Interaction interaction)
          Forwards the call to all the replicas and then call the replica.
 
Methods inherited from class org.objectweb.jac.aspects.distribution.consistency.ConsistencyWrapper
acceptRemoteCall, acceptRemoteRead, addKnownReplica, addMember, expandMethods, getConsistencyWrapperType, getKnownReplicas, getVisitedReplicas, invalidateTopology, 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, setAspectComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StrongPushConsistencyWrapper

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

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

StrongPushConsistencyWrapper

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

Method Detail

whenWrite

public Object whenWrite(Interaction interaction)
Forwards the call to all the replicas and then call the replica.

The pushing mecanism is stopped by using the collaboration attribute value defined by visitedReplicas.

Overrides:
whenWrite in class ConsistencyWrapper
Returns:
the value returned by the wrapped method.
See Also:
ConsistencyWrapper.getVisitedReplicas()

acceptRemoteWrite

public Object acceptRemoteWrite(Wrappee wrappee,
                                RemoteRef remoteReplica,
                                Object[] data)
This method is called by whenWrite to push the needed data when a state is writen in a remote replica. The data is :

Overrides:
acceptRemoteWrite in class ConsistencyWrapper
Parameters:
remoteReplica - expected to be a reference on the remote replica that recieved the write event
data - the data transmittedd by whenWrite
Returns:
null by default
See Also:
whenWrite(Interaction)

whenBindingNewReplica

public void whenBindingNewReplica(Wrappee wrappee,
                                  RemoteRef newReplica)
Push the current replica state to the binding new replica.

Parameters:
newReplica - the replica that is currently binding

Contact JAC development team:
Renaud Pawlak
Lionel Seinturier
Laurent Martelli