org.javagroups.blocks
Class Xid

java.lang.Object
  extended byorg.javagroups.blocks.Xid
All Implemented Interfaces:
java.io.Externalizable, java.io.Serializable

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

Distributed transaction ID modeled after the JTA spec. This is used to identify entities of work, with which resources are associated. A transaction will thus trigger the creation of an associated entry on each receiver, which keeps track of resources acquired and their locks, operations to be committed in case ReplicatioReceiver#commit(Xid)is called
A transaction is identified by its creator and a transaction ID. The creator is currently a JavaGroups address, consisting of the IP address and port of the member.
Note that this class might be replaced in the future with the real JTA counterpart.

Version:
$Revision: 1.12 $

Revisions:

Dec 28 2002 Bela Ban: first implementation

Author:
Bela Ban.
See Also:
Serialized Form

Field Summary
protected  Address creator
           
static int DIRTY_READS
          Writes are serialized, but reads can be dirty, e.g.
protected  long id
           
protected  int mode
           
protected static long next_id
           
static int READ_COMMITTED
          Reads are dirty until another transaction actually commits; at that points the modified data will be reflected here.
static int REPEATABLE_READ
          Each read causes the data read to be copied to the private workspace, so subsequent reads always read the private data.
static int SERIALIZABLE
          Reads and writes require locks.
static java.lang.String XID
           
 
Constructor Summary
Xid()
           
 
Method Summary
 int compareTo(java.lang.Object o)
           
static Xid create(Address creator)
           
static Xid create(Address creator, int mode)
           
 boolean equals(java.lang.Object other)
           
 Address getCreator()
           
 long getId()
           
 long getMode()
           
 int hashCode()
           
static java.lang.String modeToString(int m)
           
 void readExternal(java.io.ObjectInput in)
           
 java.lang.String toString()
           
 void writeExternal(java.io.ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

creator

protected Address creator

id

protected long id

mode

protected int mode

next_id

protected static transient long next_id

XID

public static final java.lang.String XID
See Also:
Constant Field Values

DIRTY_READS

public static final int DIRTY_READS
Writes are serialized, but reads can be dirty, e.g. a data might have been changed while we read it. This is fast because we don't need to acquire locks for reads.

See Also:
Constant Field Values

READ_COMMITTED

public static final int READ_COMMITTED
Reads are dirty until another transaction actually commits; at that points the modified data will be reflected here.

See Also:
Constant Field Values

REPEATABLE_READ

public static final int REPEATABLE_READ
Each read causes the data read to be copied to the private workspace, so subsequent reads always read the private data.

See Also:
Constant Field Values

SERIALIZABLE

public static final int SERIALIZABLE
Reads and writes require locks. This is very costly, and is not recommended (and currently not implemented either :-)).

See Also:
Constant Field Values
Constructor Detail

Xid

public Xid()
Method Detail

getCreator

public Address getCreator()

getId

public long getId()

getMode

public long getMode()

create

public static Xid create(Address creator)
                  throws java.lang.Exception
Throws:
java.lang.Exception

create

public static Xid create(Address creator,
                         int mode)
                  throws java.lang.Exception
Throws:
java.lang.Exception

modeToString

public static java.lang.String modeToString(int m)

equals

public boolean equals(java.lang.Object other)

hashCode

public int hashCode()

compareTo

public int compareTo(java.lang.Object o)

toString

public java.lang.String toString()

writeExternal

public void writeExternal(java.io.ObjectOutput out)
                   throws java.io.IOException
Specified by:
writeExternal in interface java.io.Externalizable
Throws:
java.io.IOException

readExternal

public void readExternal(java.io.ObjectInput in)
                  throws java.io.IOException,
                         java.lang.ClassNotFoundException
Specified by:
readExternal in interface java.io.Externalizable
Throws:
java.io.IOException
java.lang.ClassNotFoundException


Copyright © 2001,2002 www.javagroups.com . All Rights Reserved.