org.jgroups.blocks

Class Xid

Implemented Interfaces:
Externalizable

public class Xid
extends java.lang.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 ReplicationReceiver.commit(Xid)is 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

static int
DIRTY_READS
Writes are serialized, but reads can be dirty; e.g., a data might have been changed while we read it.
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 String
XID
protected Address
creator
protected long
id
protected int
mode
protected static long
next_id

Constructor Summary

Xid()

Method Summary

int
compareTo(Object o)
static Xid
create(Address creator)
static Xid
create(Address creator, int mode)
boolean
equals(Object other)
Address
getCreator()
long
getId()
long
getMode()
int
hashCode()
static String
modeToString(int m)
void
readExternal(ObjectInput in)
String
toString()
void
writeExternal(ObjectOutput out)

Field Details

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.
Field Value:
1

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.
Field Value:
2

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.
Field Value:
3

SERIALIZABLE

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

XID

public static final String XID

creator

protected Address creator

id

protected long id

mode

protected int mode

next_id

protected static long next_id

Constructor Details

Xid

public Xid()

Method Details

compareTo

public int compareTo(Object o)

create

public static Xid create(Address creator)
            throws Exception

create

public static Xid create(Address creator,
                         int mode)
            throws Exception

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)
            throws IOException,
                   ClassNotFoundException

toString

public String toString()

writeExternal

public void writeExternal(ObjectOutput out)
            throws IOException

Copyright B) 1998-2005 Bela Ban. All Rights Reserved.