br.shob
Class PhantomReference

java.lang.Object
  |
  +--br.shob.DefaultSharedReference
        |
        +--br.shob.PhantomReference
All Implemented Interfaces:
SharedReference

public final class PhantomReference
extends DefaultSharedReference

A PhantomReference is a special reference that contains an old entry and does not:

It is used primarily by StorageEnvents who need to inform what value has been replaced.

When methods that would require a live reference are called on a PhantomReference, a PhantomCallException is thrown and no work is done. Such methods are BeginTrans, Commit, Rollback, etc.

Version:
$Revision: 1.5 $
Author:
crolmos, dukejeffrie
Created:
September 8, 2002

Field Summary
 
Fields inherited from interface br.shob.SharedReference
defaultLeaseTime
 
Constructor Summary
PhantomReference(String globalName, Serializable obj)
          Constructor for the PhantomReference object.
PhantomReference(String globalName, SharedSpace shob, Serializable obj)
          Constructor for the PhantomReference object
 
Method Summary
 Object getData()
          Gets the data attribute of the PhantomReference object
 void srBeginTrans()
          This method throws a PhantomCallException and should not be called.
 void srCommit()
          This method throws a PhantomCallException and should not be called.
 boolean srIsUpdated()
          This method always returns true.
 void srRollback()
          This method throws a PhantomCallException and should not be called.
 void srUnshare()
          This method throws a PhantomCallException and should not be called.
 void srValidate()
          This method throws a PhantomCallException and should not be called.
 
Methods inherited from class br.shob.DefaultSharedReference
equals, hashCode, srAddStorageListener, srCallMethod, srEquals, srEquals, srGetGlobalName, srRemoveStorageListener, srToString, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PhantomReference

public PhantomReference(String globalName,
                        SharedSpace shob,
                        Serializable obj)
Constructor for the PhantomReference object

Parameters:
globalName - the global name of the object referenced
shob - the shared space who can find the object
obj - the old value of the shared object

PhantomReference

public PhantomReference(String globalName,
                        Serializable obj)
Constructor for the PhantomReference object. Same as calling the constructor and passing a null shared space

Parameters:
globalName - Description of the Parameter
obj - Description of the Parameter
Method Detail

getData

public Object getData()
Gets the data attribute of the PhantomReference object

Overrides:
getData in class DefaultSharedReference
Returns:
The data value

srBeginTrans

public void srBeginTrans()
                  throws ShobException,
                         AlreadyLockedException
This method throws a PhantomCallException and should not be called.

Specified by:
srBeginTrans in interface SharedReference
Overrides:
srBeginTrans in class DefaultSharedReference
Throws:
ShobException - Description of the Exception
AlreadyLockedException - Description of the Exception

srCommit

public void srCommit()
              throws ShobException,
                     NotLockedException
This method throws a PhantomCallException and should not be called.

Specified by:
srCommit in interface SharedReference
Overrides:
srCommit in class DefaultSharedReference
Throws:
ShobException - Description of the Exception
NotLockedException - Description of the Exception

srIsUpdated

public boolean srIsUpdated()
This method always returns true.

Specified by:
srIsUpdated in interface SharedReference
Overrides:
srIsUpdated in class DefaultSharedReference
Returns:
true

srRollback

public void srRollback()
                throws ShobException,
                       NotLockedException
This method throws a PhantomCallException and should not be called.

Specified by:
srRollback in interface SharedReference
Overrides:
srRollback in class DefaultSharedReference
Throws:
ShobException - Description of the Exception
NotLockedException - Description of the Exception

srUnshare

public void srUnshare()
               throws ShobException
This method throws a PhantomCallException and should not be called.

Specified by:
srUnshare in interface SharedReference
Overrides:
srUnshare in class DefaultSharedReference
Throws:
ShobException - Description of the Exception

srValidate

public void srValidate()
                throws ShobException
This method throws a PhantomCallException and should not be called.

Specified by:
srValidate in interface SharedReference
Overrides:
srValidate in class DefaultSharedReference
Throws:
ShobException - Description of the Exception