uka.karmi.rmi
Class GlobalSynchronization

java.lang.Object
  extended byuka.karmi.rmi.GlobalSynchronization

public abstract class GlobalSynchronization
extends java.lang.Object


Field Summary
static int CHILDS_LOCKED
           
static int CHILDS_UNLOCKED
           
protected  CallHandler handler
           
static int LOCK_CHILDS
           
static int LOCK_ROOT
           
static int ROOT_LOCKED
           
static int SIBLINGS_LOCKED
           
static int SIBLINGS_UNLOCKED
           
protected  long tid
           
static int UNLOCK_CHILDS
           
static int UNLOCK_PARENT
           
 
Constructor Summary
GlobalSynchronization(long tid)
           
 
Method Summary
protected abstract  java.lang.Object getLocalLock()
           
protected abstract  boolean isRoot()
           
 void postLock()
           
 void postUnlock()
           
 void preLock()
          Main entry point for an application thread when requesting a global synchronization.
 void preUnlock()
           
 void processLockChilds()
           
 void processLockRoot(int childIdx)
           
protected abstract  void receiveAllChilds(int code)
           
protected abstract  void receiveChildNonBlocking(int idx, int code)
           
protected abstract  void receiveOtherChilds(int idx, int code)
           
protected abstract  void receiveParent(int code)
           
protected abstract  void receiveParentNonBlocking(int code)
           
protected  void release()
           
protected abstract  void sendAllChilds(int code)
           
protected abstract  void sendChild(int idx, int code)
           
protected abstract  void sendOtherChilds(int idx, int code)
           
protected abstract  void sendParent(int code)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOCK_ROOT

public static final int LOCK_ROOT
See Also:
Constant Field Values

ROOT_LOCKED

public static final int ROOT_LOCKED
See Also:
Constant Field Values

LOCK_CHILDS

public static final int LOCK_CHILDS
See Also:
Constant Field Values

CHILDS_LOCKED

public static final int CHILDS_LOCKED
See Also:
Constant Field Values

SIBLINGS_LOCKED

public static final int SIBLINGS_LOCKED
See Also:
Constant Field Values

UNLOCK_PARENT

public static final int UNLOCK_PARENT
See Also:
Constant Field Values

SIBLINGS_UNLOCKED

public static final int SIBLINGS_UNLOCKED
See Also:
Constant Field Values

UNLOCK_CHILDS

public static final int UNLOCK_CHILDS
See Also:
Constant Field Values

CHILDS_UNLOCKED

public static final int CHILDS_UNLOCKED
See Also:
Constant Field Values

handler

protected CallHandler handler

tid

protected final long tid
Constructor Detail

GlobalSynchronization

public GlobalSynchronization(long tid)
Method Detail

getLocalLock

protected abstract java.lang.Object getLocalLock()

release

protected void release()
                throws java.io.IOException,
                       java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

preLock

public void preLock()
             throws java.io.IOException,
                    java.lang.ClassNotFoundException

Main entry point for an application thread when requesting a global synchronization. The pattern to request a global synchronization is the following:

 preLock()
   synchronized (this) {
     postLock()
     // code that requires global synchronization.
     preUnlock()
   }
 postUnlock()

Throws:
java.io.IOException
java.lang.ClassNotFoundException

postLock

public void postLock()
              throws java.io.IOException,
                     java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
preLock()

preUnlock

public void preUnlock()
               throws java.io.IOException,
                      java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
preLock()

postUnlock

public void postUnlock()
                throws java.io.IOException,
                       java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
preLock()

processLockRoot

public void processLockRoot(int childIdx)
                     throws java.io.IOException,
                            java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

processLockChilds

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

isRoot

protected abstract boolean isRoot()

sendParent

protected abstract void sendParent(int code)
                            throws java.io.IOException,
                                   java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

receiveParent

protected abstract void receiveParent(int code)
                               throws java.io.IOException,
                                      java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

receiveParentNonBlocking

protected abstract void receiveParentNonBlocking(int code)
                                          throws java.io.IOException,
                                                 java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

sendChild

protected abstract void sendChild(int idx,
                                  int code)
                           throws java.io.IOException,
                                  java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

receiveChildNonBlocking

protected abstract void receiveChildNonBlocking(int idx,
                                                int code)
                                         throws java.io.IOException,
                                                java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

sendAllChilds

protected abstract void sendAllChilds(int code)
                               throws java.io.IOException,
                                      java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

receiveAllChilds

protected abstract void receiveAllChilds(int code)
                                  throws java.io.IOException,
                                         java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

sendOtherChilds

protected abstract void sendOtherChilds(int idx,
                                        int code)
                                 throws java.io.IOException,
                                        java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

receiveOtherChilds

protected abstract void receiveOtherChilds(int idx,
                                           int code)
                                    throws java.io.IOException,
                                           java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException