Home

xl2.odb
Class XL2Reference

java.lang.Object
  |
  +--xl2.odb.XL2Reference
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

public class XL2Reference
extends java.lang.Object
implements java.io.Externalizable

Persistent reference.

Parents and Referents

Transactional Locking Memory Important
To clear an XL2Reference, set the referent to null. For example: But never reassign an XL2Reference field. This will result in a persistent garbage leak. The following kinds of statements should never be written:

Since:
Java 2
See Also:
XL2Transaction, Serialized Form

Constructor Summary
XL2Reference()
           
XL2Reference(int meaningless)
          Constructs an XL2Reference with itself as the parent such that changing the ref will lock itself with the current XL2Transaction.
XL2Reference(java.lang.Object parent)
          Constructs an XL2Reference with the specified parent.
 
Method Summary
 java.lang.Object get()
          Returns the referent.
 void readExternal(java.io.ObjectInput in)
          For serialization, not for applications.
 void set(java.lang.Object obj)
          Changes the referent.
 void writeExternal(java.io.ObjectOutput out)
          For serialization, not for applications.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XL2Reference

public XL2Reference()

XL2Reference

public XL2Reference(int meaningless)
Constructs an XL2Reference with itself as the parent such that changing the ref will lock itself with the current XL2Transaction. The parameter has no meaning.
Parameters:
meaningless - Has no meaning.
See Also:
XL2Reference(Object)

XL2Reference

public XL2Reference(java.lang.Object parent)
             throws InvalidObjectException,
                    LockNotGrantedException
Constructs an XL2Reference with the specified parent. Must be done in a transaction.
Throws:
XL2Exception - When the calling thread is not joined to a transaction.
InvalidObjectException - When the parent was previously locked by a transaction that was aborted.
LockNotGrantedException - When the parent has a conflicting lock with another transaction.
See Also:
XL2Transaction
Method Detail

get

public java.lang.Object get()
Returns the referent. Fetches the object from the database if needed.
Throws:
XL2Exception - If no transaction is in progress.

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.lang.ClassNotFoundException,
                         java.io.IOException
For serialization, not for applications.
Specified by:
readExternal in interface java.io.Externalizable
See Also:
Externalizable

set

public void set(java.lang.Object obj)
         throws InvalidObjectException,
                LockNotGrantedException
Changes the referent. If a parent was specified during construction, then it will be locked by the current XL2Transaction. If the parameter is not currently stored in the database, it will be locked by the current transaction.
Parameters:
obj - The new referent.
Throws:
XL2Exception - When the current thread is not joined to a transaction.
InvalidObjectException - If the object was previously locked by a transaction that was aborted.
LockNotGrantedException - When either the parent or referent is locked by another transaction.

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
For serialization, not for applications.
Specified by:
writeExternal in interface java.io.Externalizable
See Also:
Externalizable

Home