uka.karmi.rmi.server
Class ReplicatedObject

java.lang.Object
  extended byuka.karmi.rmi.server.ReplicatedObject
All Implemented Interfaces:
PatchableRoot, Printable, Replicated, java.io.Serializable

public class ReplicatedObject
extends java.lang.Object
implements Replicated, Printable, java.io.Serializable

Author:
Bernhard Haumacher
See Also:
Serialized Form

Field Summary
private static int DEFAULT_FANOUT
           
 ReplicatedServerRef serverRef
           
 
Constructor Summary
protected ReplicatedObject(RemoteStub[] distribution)
           
protected ReplicatedObject(RemoteStub[] distribution, Distributor distributor)
           
 
Method Summary
 SingleRemoteClientRef _exportReplica(PartitionedObjectSpace objects, int rank)
          Exports a new replica that has just arrived at the current node during the distribution process.
 void appendTo(ToString s)
          This method should append the contents of each instance variable of the current object to the given ToString object.
 void barrier()
           
 void barrier(int fanout)
          Collective synchronize on this replicated object without any data exchange.
 void collectiveUpdate()
           
 void distributeTo(java.lang.Object obj, boolean[] ranks)
           
 void distributeTo(java.lang.Object obj, int[] ranks)
           
 java.lang.Object[] exchange(java.lang.Object[] args)
          Exchange data among cooperating threads.
 void exclusiveUpdate()
           
 ReplicaDiagnostics getDiagnostics()
           
 java.lang.Object getOwner()
          Return the root object this object belongs to.
 int getRank()
           
 int getSize()
           
 boolean isReadOnly(java.lang.Object object)
           
 void postAcquireExclusiveLock(java.lang.Object lock)
           
 void postReleaseExclusiveLock(java.lang.Object lock)
           
 java.lang.Object preAcquireExclusiveLock()
           
 void preReleaseExclusiveLock(java.lang.Object lock)
           
 void replicatedNotify()
           
 void replicatedWait()
           
 void setReadOnly(java.lang.Object object, boolean value)
          Mark the passed object as read-only.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serverRef

public transient ReplicatedServerRef serverRef

DEFAULT_FANOUT

private static final int DEFAULT_FANOUT
See Also:
Constant Field Values
Constructor Detail

ReplicatedObject

protected ReplicatedObject(RemoteStub[] distribution)
                    throws RemoteException

ReplicatedObject

protected ReplicatedObject(RemoteStub[] distribution,
                           Distributor distributor)
                    throws RemoteException
Method Detail

_exportReplica

public SingleRemoteClientRef _exportReplica(PartitionedObjectSpace objects,
                                            int rank)
                                     throws RemoteException
Exports a new replica that has just arrived at the current node during the distribution process. This replica is not yet completely initialized, because the references to other replicas are not yet valid. This initialization is done in a second phase after all replicas of a replicated object have been created and exported.

Throws:
RemoteException
See Also:
Technology.serviceCreateReplicaBody(uka.patch.PartitionedObjectSpace, java.lang.Object, int), ReplicatedServerRef.updateReferences(uka.karmi.rmi.SingleRemoteClientRef[])

getDiagnostics

public ReplicaDiagnostics getDiagnostics()

preAcquireExclusiveLock

public java.lang.Object preAcquireExclusiveLock()
                                         throws RemoteException
Throws:
RemoteException

postAcquireExclusiveLock

public void postAcquireExclusiveLock(java.lang.Object lock)
                              throws RemoteException
Throws:
RemoteException

replicatedWait

public void replicatedWait()
                    throws java.lang.InterruptedException,
                           RemoteException
Throws:
java.lang.InterruptedException
RemoteException

replicatedNotify

public void replicatedNotify()

preReleaseExclusiveLock

public void preReleaseExclusiveLock(java.lang.Object lock)
                             throws RemoteException
Throws:
RemoteException

postReleaseExclusiveLock

public void postReleaseExclusiveLock(java.lang.Object lock)
                              throws RemoteException
Throws:
RemoteException

exclusiveUpdate

public void exclusiveUpdate()
                     throws java.io.IOException,
                            java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

collectiveUpdate

public void collectiveUpdate()
                      throws java.io.IOException,
                             java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

exchange

public java.lang.Object[] exchange(java.lang.Object[] args)
                            throws java.io.IOException,
                                   java.lang.ClassNotFoundException
Exchange data among cooperating threads. See FEATURE/0177.

Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
ReplicatedServerRef.exchange(java.lang.Object[])

barrier

public void barrier()
             throws java.lang.InterruptedException,
                    RemoteException
Throws:
java.lang.InterruptedException
RemoteException
See Also:
barrier(int)

barrier

public final void barrier(int fanout)
                   throws java.lang.InterruptedException,
                          RemoteException
Collective synchronize on this replicated object without any data exchange.

Throws:
java.lang.InterruptedException
RemoteException
See Also:
ReplicatedServerRef.barrier(int)

distributeTo

public void distributeTo(java.lang.Object obj,
                         int[] ranks)
See Also:
ReplicatedServerRef.distributeTo(java.lang.Object, int[])

distributeTo

public void distributeTo(java.lang.Object obj,
                         boolean[] ranks)
See Also:
ReplicatedServerRef.distributeTo(java.lang.Object, int[])

getRank

public int getRank()

getSize

public int getSize()

getOwner

public final java.lang.Object getOwner()
Description copied from interface: PatchableRoot
Return the root object this object belongs to. The replicated state of a replicated object extends to all objects that are reacheable through non-transient references from the replicated root object. The traversal ends at objects implementing PatchableRoot, if the PatchableRoot.getOwner() method returns another object than the current replicated object.

Specified by:
getOwner in interface PatchableRoot
See Also:
PatchableRoot.getOwner()

appendTo

public void appendTo(ToString s)
Description copied from interface: Printable
This method should append the contents of each instance variable of the current object to the given ToString object. The appended data should be labeled with the name of the corresponding instance variable.

Specified by:
appendTo in interface Printable
See Also:
ToString, ToString.append(String, Object), ToString.append(String, boolean), ToString.append(String, byte), ToString.append(String, int)

setReadOnly

public void setReadOnly(java.lang.Object object,
                        boolean value)
Mark the passed object as read-only. This infromation is propagated to other replicas during the next update after an exclusive or collective synchronization.


isReadOnly

public boolean isReadOnly(java.lang.Object object)