|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuka.karmi.rmi.server.RemoteServerRef
uka.karmi.rmi.server.ReplicatedServerRef
| Nested Class Summary | |
static class |
ReplicatedServerRef.CollectiveOperation
|
(package private) class |
ReplicatedServerRef.CollectiveUpdate
|
(package private) class |
ReplicatedServerRef.CollectiveUpdateNode
Implementation of the GraphNode interface. |
class |
ReplicatedServerRef.ExclusiveLock
Note: The exclusive lock process extends the regular call protocol to: |
(package private) static class |
ReplicatedServerRef.Wakeup
|
| Field Summary | |
(package private) int |
applyCnt
|
(package private) int[] |
applyFirstID
|
(package private) int[] |
applyRank
|
(package private) int |
barrierChildCnt
|
(package private) ServerConnection[] |
barrierChilds
|
(package private) Connection[] |
collectiveConnections
Contains connections to all other participants of a collective operation. |
private ReplicatedServerRef.CollectiveOperation |
collectiveUpdate
|
(package private) uka.graph.ColoringAlgorithm |
coloring
Algorithm object for coloring the update graph of a partially replicated object. |
(package private) ReplicaDiagnostics |
diagnostics
|
(package private) java.util.HashMap |
exclusiveLockSpace
|
(package private) int |
exclusiveTicket
|
(package private) boolean |
isNotified
|
(package private) ReplicatedServerRef.ExclusiveLock |
lock
The lock of the thread that currently holds an exclusive lock on the corresponding replicated object. |
(package private) ReplicatedServerRef.CollectiveUpdateNode |
node
A helper object that implements the GraphNode interface
for distributed coloring of the replicas for optimized
collective updates. |
(package private) PatchAdapterImpl |
objectAdapter
The local replica. |
(package private) PartitionedObjectSpace |
objects
|
(package private) MultiplexPatchWriter |
patchWriter
|
(package private) int |
rank
This replica is at position rank in the replica array. |
(package private) SingleRemoteClientRef[] |
replica
Remote references of all replicas of this replicated server. |
(package private) java.util.HashMap |
replicatedWaitSet
The thread waiting in a replicatedWait() only wants
to be woken up by a call to replicatedNotify(). |
(package private) int |
updateTicket
|
private boolean |
useColoring
Determines wether the graph coloring optimization is used during collective updates. |
(package private) int |
validExclusiveTicket
|
(package private) int |
validUpdateTicket
|
| Fields inherited from class uka.karmi.rmi.server.RemoteServerRef |
callCounter, ep, objectId, objectId2 |
| Constructor Summary | |
ReplicatedServerRef(PartitionedObjectSpace objects,
java.lang.Object root,
int rank)
Create an initial server reference for a single replica that is part of a replicated object. |
|
| Method Summary | |
void |
appendTo(ToString s)
This method should append the contents of each instance variable of the current
object to the given ToString object. |
protected void |
awaitWakeUp(ClientConnection[] wakeUpConnections)
|
void |
barrier(int fanout)
|
private void |
checkDistribute(java.lang.Object obj)
Throw an IllegalArgumentException, if the passed object
is set to read-only state. |
protected void |
clearReplicatedWaitSet()
|
private void |
closeCollectiveConnections()
|
protected void |
closeWakeUpConnections(ClientConnection[] wakeUpConnections)
|
(package private) int |
createTicket()
|
void |
deliverMessage(int rank,
uka.graph.Message message)
Deliver message to some rank. |
void |
distributeTo(java.lang.Object obj,
boolean[] ranks)
With this method, you can assign parts of an replicated object to some of replicas of this replicated object. |
void |
distributeTo(java.lang.Object obj,
int[] ranks)
With this method, you can assign parts of an replicated object to some of replicas of this replicated object. |
void |
doApplicationCall(ServerConnection c)
The entry-point into the method dispatch process. |
private void |
doCollectiveOperation(int mid,
ReplicatedServerRef.CollectiveOperation op)
|
java.lang.Object[] |
exchange(java.lang.Object[] args)
Exchange data among cooperating threads. |
ReplicaDiagnostics |
getDiagnostics()
|
java.lang.Object |
getObject()
|
PatchAdapter |
getObjectAdapter()
|
SingleRemoteClientRef[] |
getReplicas()
|
SingleRemoteClientRef |
getSelfReference()
|
RemoteStub |
getStub()
Returns a corresponding stub object. |
void |
init()
Called from the ColoringAlgorithm before computing a
new graph coloring. |
boolean |
isReadOnly(java.lang.Object obj)
|
protected boolean |
isThreadRegistered()
|
private void |
openCollectiveConnections(int mid,
IntIterator ranks)
|
void |
postAcquireExclusiveLock(ReplicatedServerRef.ExclusiveLock lock)
|
void |
postReleaseExclusiveLock(ReplicatedServerRef.ExclusiveLock lock)
|
ReplicatedServerRef.ExclusiveLock |
preAcquireExclusiveLock()
First part of the protocol necessary to acquire an exclusive lock on a replicated object. |
void |
preReleaseExclusiveLock(ReplicatedServerRef.ExclusiveLock lock)
|
private void |
receiveBarrier(ServerConnection c)
|
void |
receiveCollectiveConnection(ServerConnection c)
Called from ServerConnection.dispatch(boolean) for connections
marked with the command ID Constants.COLLECTIVE_OPERATION. |
(package private) void |
receiveExclusiveLock(ServerConnection c)
|
void |
receiveExclusiveUpdate(ServerConnection c)
|
uka.graph.Message |
receiveMessage(int rank)
Receive a message from some rank. |
(package private) void |
receiveTicketRequest(ServerConnection c)
|
(package private) void |
receiveWait(ServerConnection c)
|
(package private) void |
receiveWakeUp(ServerConnection c)
|
protected void |
registerWaitingThread()
|
boolean |
remoteEquals(RemoteStub obj)
Determines if a stub object references this server object. |
void |
replicatedNotify()
|
void |
replicatedWait()
|
void |
sendCollectiveUpdate()
|
void |
sendExclusiveUpdate()
|
protected ClientConnection[] |
sendWakeUp(int ticket)
|
void |
setReadOnly(java.lang.Object obj,
boolean value)
|
void |
setReplica(int replicaRank,
SingleRemoteClientRef replicaRef)
The the reference to replica at index replicaRank. |
void |
synchronize(RMACallback cb)
Synchronize on the local replica that is the root of objectAdapter and call the given callback method. |
java.lang.String |
toStringMembers()
|
void |
unreferenced()
Called whenever the last remote reference to this server implementation is garbage collected. |
private void |
updateFinished()
Called at the end of each update after an exclusive or collective synchronization. |
void |
updateReferences(SingleRemoteClientRef[] refs)
|
| Methods inherited from class uka.karmi.rmi.server.RemoteServerRef |
createSkeletonFor, createStubFor, decCallCounter, getClientHost, incCallCounter, newInstanceRelative, toString |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
SingleRemoteClientRef[] replica
Connection[] collectiveConnections
int rank
rank in the replica array.
PartitionedObjectSpace objects
PatchAdapterImpl objectAdapter
MultiplexPatchWriter patchWriter
int[] applyRank
int[] applyFirstID
int applyCnt
int updateTicket
int validUpdateTicket
int exclusiveTicket
int validExclusiveTicket
boolean isNotified
private boolean useColoring
updateFinished()ReplicatedServerRef.ExclusiveLock lock
java.util.HashMap replicatedWaitSet
The thread waiting in a replicatedWait() only wants
to be woken up by a call to replicatedNotify(). All
other calls to Object.notify() and Object.notifyAll() are used for internal signaling and should
not trigger the replicated wakeup sequence.
In 'replicatedWait()' every thread registers itself at the
replicatedWaitSet. replicatedNotify() empties
this set and calls Object.notifyAll(). All awaking
threads can test, whether they are still in the set. If they
are still in there, they keep on sleeping. If they are not,
they start their wake up process.
java.util.HashMap exclusiveLockSpace
uka.graph.ColoringAlgorithm coloring
ReplicatedServerRef.CollectiveUpdateNode node
GraphNode interface
for distributed coloring of the replicas for optimized
collective updates.
ReplicaDiagnostics diagnostics
private final ReplicatedServerRef.CollectiveOperation collectiveUpdate
int barrierChildCnt
ServerConnection[] barrierChilds
| Constructor Detail |
public ReplicatedServerRef(PartitionedObjectSpace objects,
java.lang.Object root,
int rank)
throws RemoteException
ReplicatedObject and is used to
export the initial replica of a new ReplicatedObject. After creation, this server reference is not
yet completely initialized, because it is not yet connected to
the other replicas.
| Method Detail |
public SingleRemoteClientRef getSelfReference()
public void setReplica(int replicaRank,
SingleRemoteClientRef replicaRef)
replicaRank.
public SingleRemoteClientRef[] getReplicas()
public void updateReferences(SingleRemoteClientRef[] refs)
throws RemoteException
RemoteExceptionTechnology.serviceUpdateReferencesBody(uka.karmi.rmi.server.ReplicatedServerRef, uka.karmi.rmi.SingleRemoteClientRef[])public ReplicaDiagnostics getDiagnostics()
public void distributeTo(java.lang.Object obj,
int[] ranks)
public void distributeTo(java.lang.Object obj,
boolean[] ranks)
private void checkDistribute(java.lang.Object obj)
IllegalArgumentException, if the passed object
is set to read-only state. The distribution of a read-only
object cannot be changed, because the update to the
distribution specification must be propagated to other replicas
during update. This propagation might be impossible for a
read-only object, because replicas of this object might exist
at ranks that are not in the active group. Since communication
links are only established with replicas in the active group,
an inconsistency of the specified distribution might occur.
java.lang.IllegalArgumentExceptionpublic PatchAdapter getObjectAdapter()
public ReplicatedServerRef.ExclusiveLock preAcquireExclusiveLock()
throws RemoteException
First part of the protocol necessary to acquire an exclusive lock on a replicated object. To acquire an exclusive lock on a replicated object, all locks of its local replicas have to be acquired. The acquisition has to be done in an ordered way to prevent deadlocks. First, a ticket for exclusive update is requested from replica #0. Second, lock requests using the received ticket are sent to all replicas, except the local one. Third, the local lock is acquired. Forth, the acknowledgment from all other nodes is awaited.
The acquisition of all locks works as follows: First, the lock is requested in a synchronized block. Second, the thread waits, until its current ticket become valid.
The acquisition of an exclusive lock requires the following call protocol:
preAcquireExclusiveLock();
synchronized (localReplica) {
postAcquireExclusiveLock();
// The exclusive synchronized operation.
preReleaseExclusiveLock();
}
postReleaseExclusiveLock();
RemoteException
public void postAcquireExclusiveLock(ReplicatedServerRef.ExclusiveLock lock)
throws RemoteException
RemoteExceptionpreAcquireExclusiveLock()public void replicatedNotify()
protected void registerWaitingThread()
protected boolean isThreadRegistered()
protected void clearReplicatedWaitSet()
public void replicatedWait()
throws java.lang.InterruptedException,
RemoteException
java.lang.InterruptedException
RemoteException
public void preReleaseExclusiveLock(ReplicatedServerRef.ExclusiveLock lock)
throws RemoteException
RemoteExceptionpreAcquireExclusiveLock()
public void postReleaseExclusiveLock(ReplicatedServerRef.ExclusiveLock lock)
throws RemoteException
RemoteExceptionpreAcquireExclusiveLock()
public void sendExclusiveUpdate()
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void setReadOnly(java.lang.Object obj,
boolean value)
public boolean isReadOnly(java.lang.Object obj)
protected ClientConnection[] sendWakeUp(int ticket)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
protected void awaitWakeUp(ClientConnection[] wakeUpConnections)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
protected void closeWakeUpConnections(ClientConnection[] wakeUpConnections)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void receiveExclusiveUpdate(ServerConnection c)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
private void openCollectiveConnections(int mid,
IntIterator ranks)
throws java.io.IOException
java.io.IOExceptionpublic void init()
uka.graph.ChannelColoringAlgorithm before computing a
new graph coloring.
init in interface uka.graph.Channel
public void deliverMessage(int rank,
uka.graph.Message message)
throws uka.graph.MessageDeliveryException
uka.graph.Channel
deliverMessage in interface uka.graph.Channelrank - The rank to which the message is delivered.
uka.graph.MessageDeliveryException
public uka.graph.Message receiveMessage(int rank)
throws uka.graph.MessageDeliveryException
uka.graph.Channel
receiveMessage in interface uka.graph.Channelrank - The rank that sent the message.
uka.graph.MessageDeliveryException
private void closeCollectiveConnections()
throws java.io.IOException
java.io.IOException
private void doCollectiveOperation(int mid,
ReplicatedServerRef.CollectiveOperation op)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void sendCollectiveUpdate()
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundExceptionprivate void updateFinished()
public java.lang.Object[] exchange(java.lang.Object[] args)
throws java.io.IOException,
java.lang.ClassNotFoundException
Exchange data among cooperating threads.
Note: The current implementation has room for
improvements: Since the collective exchange does not modify the
shared object space of the associated replicated object, there
is no need for ordering the send/receive operations. To achieve
better overlapping, the server thread that receives the
collective connection in receiveCollectiveConnection(uka.karmi.rmi.ServerConnection)
could immediately unmarshal the data and store it to a shared
array (instead of the connection). Now, each sender could
broadcast its data and wait afterwards until all data was
received.
java.io.IOException
java.lang.ClassNotFoundException
public void barrier(int fanout)
throws java.lang.InterruptedException,
RemoteException
java.lang.InterruptedException
RemoteException
private void receiveBarrier(ServerConnection c)
throws RemoteException
RemoteException
public void receiveCollectiveConnection(ServerConnection c)
throws java.io.IOException,
java.lang.ClassNotFoundException
ServerConnection.dispatch(boolean) for connections
marked with the command ID Constants.COLLECTIVE_OPERATION.
java.io.IOException
java.lang.ClassNotFoundException
void receiveExclusiveLock(ServerConnection c)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundExceptionint createTicket()
void receiveTicketRequest(ServerConnection c)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
void receiveWakeUp(ServerConnection c)
throws java.io.IOException
java.io.IOException
void receiveWait(ServerConnection c)
throws java.io.IOException,
java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException
public void doApplicationCall(ServerConnection c)
throws java.io.IOException,
java.lang.ClassNotFoundException
RemoteServerRefdispatch() method of the server
connection. The actual dispatch is done in a sub-class of
RemoteServerRef. This abstract method is
implemented for unicast servers in the
UnicastRemoteServerRef class.
doApplicationCall in class RemoteServerRefc - the connection, the call came in
java.io.IOException
java.lang.ClassNotFoundExceptionServerConnection.dispatch(boolean),
UnicastRemoteServerRef.doApplicationCall(ServerConnection)public void unreferenced()
RemoteServerRef
unreferenced in class RemoteServerRefUnreferencedpublic RemoteStub getStub()
RemoteServerRefThis stub is used during passing a remote server as argument or result in a remote method invocation.
getStub in class RemoteServerRefpublic java.lang.Object getObject()
public void synchronize(RMACallback cb)
throws java.lang.Throwable
objectAdapter and call the given callback method.
synchronize in class RemoteServerRefjava.lang.Throwablepublic boolean remoteEquals(RemoteStub obj)
RemoteServerRef
remoteEquals in class RemoteServerRefpublic void appendTo(ToString s)
Printableappend 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.
appendTo in interface PrintableToString,
ToString.append(String, Object),
ToString.append(String, boolean),
ToString.append(String, byte),
ToString.append(String, int)public java.lang.String toStringMembers()
toStringMembers in class RemoteServerRef
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||