|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This class represents a reference to shared object. References are retrieved
from a global space through the Shared
Space
instance.
SharedReference ref = shob.get("myObject_global_name");
if (ref instanceof List) {
List l = (List) ref;
readList(l);
}
SharedReferences should not be shared among different threads for
correctness. Synchronization and mutual exclusion should be left to the
shared space. In fact, if you use shared references in multi-thread
contexts, you should consider using ThreadLocal
variables, each one initialized with it's own reference.
When creating shared references to your own-developed classes, you should use the configurator tool included in the SharedObjects package.
Field Summary | |
static long |
defaultLeaseTime
This is the default lease time, set to 20 (twenty) seconds. |
Method Summary | |
void |
srBeginTrans()
Initiates a transaction for this object. |
Object |
srCallMethod(String name,
Class[] argTypes,
Object[] args)
This method calls a method from the shared object. |
void |
srCommit()
Commits a transaction. |
String |
srGetGlobalName()
Acessor for the global name. |
boolean |
srIsUpdated()
Checks if the corresponding object is updated (i.e., if his lease is expired) |
void |
srRollback()
Rolls back a transaction. |
void |
srUnshare()
Unshares this object from the global space. |
void |
srValidate()
Validates this object. |
Field Detail |
public static final long defaultLeaseTime
Method Detail |
public void srBeginTrans() throws ShobException, AlreadyLockedException
ShobException
- If a low-level error occurs
AlreadyLockedException
- If the object is already locked by this
reference.public Object srCallMethod(String name, Class[] argTypes, Object[] args) throws InvocationException, InvocationTargetException, ShobException
name
- the name of the method.argTypes
- the types of the arguments.args
- the arguments.
InvocationException
- if the method does not exist, is not
public or the argument is invalid (thrown with real cause chained)
InvocationTargetException
- if the underlying method throws an
exception.
ShobException
- If a low-level error occurspublic void srCommit() throws ShobException, NotLockedException
ShobException
- If a low-level error occurs
NotLockedException
- if the object is not inside a transactionpublic String srGetGlobalName()
public boolean srIsUpdated()
public void srRollback() throws ShobException, NotLockedException
ShobException
- If a low-level error occurs
NotLockedException
- if the object is not inside a transactionpublic void srUnshare() throws ShobException
ShobException
- If a low-level error occurspublic void srValidate() throws ShobException
ShobException
- If a low-level error occurs
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |