org.jgroups.blocks

Class Xid

public class Xid extends Object implements 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 commitis called.

A transaction is identified by its creator and a transaction ID. The creator is currently a JGroups 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.5 $

Revisions:

Dec 28 2002 Bela Ban: first implementation

Author: Bela Ban.

Field Summary
protected Addresscreator
static intDIRTY_READS
Writes are serialized, but reads can be dirty; e.g., a data might have been changed while we read it.
protected longid
protected intmode
protected static longnext_id
static intREAD_COMMITTED
Reads are dirty until another transaction actually commits; at that points the modified data will be reflected here.
static intREPEATABLE_READ
Each read causes the data read to be copied to the private workspace, so subsequent reads always read the private data.
static intSERIALIZABLE
Reads and writes require locks.
static StringXID
Constructor Summary
Xid()
Method Summary
intcompareTo(Object o)
static Xidcreate(Address creator)
static Xidcreate(Address creator, int mode)
booleanequals(Object other)
AddressgetCreator()
longgetId()
longgetMode()
inthashCode()
static StringmodeToString(int m)
voidreadExternal(ObjectInput in)
StringtoString()
voidwriteExternal(ObjectOutput out)

Field Detail

creator

protected Address creator

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.

id

protected long id

mode

protected int mode

next_id

protected static transient long next_id

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.

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.

SERIALIZABLE

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

XID

public static final String XID

Constructor Detail

Xid

public Xid()

Method Detail

compareTo

public int compareTo(Object o)

create

public static Xid create(Address creator)

create

public static Xid create(Address creator, int mode)

equals

public boolean equals(Object other)

getCreator

public Address getCreator()

getId

public long getId()

getMode

public long getMode()

hashCode

public int hashCode()

modeToString

public static String modeToString(int m)

readExternal

public void readExternal(ObjectInput in)

toString

public String toString()

writeExternal

public void writeExternal(ObjectOutput out)
Copyright ? 1998-2005 Bela Ban. All Rights Reserved.