br.shob
Class SharedObject

java.lang.Object
  |
  +--br.shob.SharedObject
All Implemented Interfaces:
Serializable

public class SharedObject
extends Object
implements Serializable

This class defines the Serializable objects that actually travel the global space, are cached in each machine, etc.

Each instance contains information about validity, leases, content class, etc. Is handled entirely by the SharedSpace and doesn't deserve much attention unless you are developing Shob.

Version:
$Revision: 1.7 $
Author:
crolmos, dukejeffrie
See Also:
Serialized Form
Created:
August 30, 2001

Field Summary
static long defaultLeaseTime
          Default lease time for objects without one.
 
Constructor Summary
SharedObject(String globalName, Serializable data)
          Constructor for the SharedObject object
SharedObject(String globalName, Serializable data, String referenceClassName)
          Constructor for the SharedObject object
 
Method Summary
 boolean canWrite()
          Returns true if the SharedSpace has acquired the writing lock for this object
 ClassLoader getClassLoader()
          Gets the classLoader attribute of the SharedObject object
protected  Serializable getData()
          Gets the data attribute of the SharedObject object
 SharedObjectDescriptor getDescriptor()
          Gets the descriptor attribute of the SharedObject object
 String getGlobalName()
          Gets the globalName attribute of the SharedObject object
 long getLeaseTime()
          Gets the leaseTime attribute of the SharedObject object
 String getReferenceClassName()
          Gets the name of the reference's class (or interface).
 TimeStamp getTimeStamp()
          Gets the timeStamp attribute of the SharedObject object
 boolean isUpdated()
          Checks if this object's lease has expired.
 void setCanWrite(boolean flag)
          Sets the canWrite attribute of the SharedObject object
 void setLastUpdated(long time)
          Sets the lastUpdated attribute of the SharedObject object
 void setLeaseTime(long lease)
          Sets the leaseTime attribute of the SharedObject object
 void setLost(boolean newLostValue)
          Sets that the object was lost.
 void setTimeStamp(TimeStamp stamp)
          Sets the timeStamp attribute of the SharedObject object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultLeaseTime

public static long defaultLeaseTime
Default lease time for objects without one.

Constructor Detail

SharedObject

public SharedObject(String globalName,
                    Serializable data)
Constructor for the SharedObject object

Parameters:
globalName - Description of the Parameter
data - Description of the Parameter

SharedObject

public SharedObject(String globalName,
                    Serializable data,
                    String referenceClassName)
Constructor for the SharedObject object

Parameters:
globalName - Description of the Parameter
data - Description of the Parameter
referenceClassName - Description of the Parameter
Method Detail

canWrite

public boolean canWrite()
Returns true if the SharedSpace has acquired the writing lock for this object

Returns:
Description of the Return Value

getClassLoader

public ClassLoader getClassLoader()
Gets the classLoader attribute of the SharedObject object

Returns:
The classLoader value

getDescriptor

public SharedObjectDescriptor getDescriptor()
Gets the descriptor attribute of the SharedObject object

Returns:
The descriptor value

getGlobalName

public String getGlobalName()
Gets the globalName attribute of the SharedObject object

Returns:
The globalName value

getLeaseTime

public long getLeaseTime()
Gets the leaseTime attribute of the SharedObject object

Returns:
The leaseTime value

getReferenceClassName

public String getReferenceClassName()
Gets the name of the reference's class (or interface). Used to reconstruct the data object on arrival.

Returns:
The referenceClassName value

getTimeStamp

public TimeStamp getTimeStamp()
Gets the timeStamp attribute of the SharedObject object

Returns:
The timeStamp value

isUpdated

public boolean isUpdated()
Checks if this object's lease has expired.

Returns:
true if the lease is still valid, false otherwise

setCanWrite

public void setCanWrite(boolean flag)
Sets the canWrite attribute of the SharedObject object

Parameters:
flag - The new canWrite value

setLastUpdated

public void setLastUpdated(long time)
Sets the lastUpdated attribute of the SharedObject object

Parameters:
time - The new lastUpdated value

setLeaseTime

public void setLeaseTime(long lease)
Sets the leaseTime attribute of the SharedObject object

Parameters:
lease - The new leaseTime value

setLost

public void setLost(boolean newLostValue)
Sets that the object was lost. This is used to avoid requerying the global space for updates on this object while its owner is unreachable.

Parameters:
newLostValue - The new lost value

setTimeStamp

public void setTimeStamp(TimeStamp stamp)
Sets the timeStamp attribute of the SharedObject object

Parameters:
stamp - The new timeStamp value

getData

protected Serializable getData()
Gets the data attribute of the SharedObject object

Returns:
The data value