org.objectweb.jotm.core.conflict
Interface ConflictManager


public interface ConflictManager

ConflictManager is the entity that takes care of concurrency control in JOTM. There are two basic concurrency control means:
ConflictTable: An entity that for a pair of operations maintains the information whether they are conflicting. Typically, The Conflict Manager maintains many conflict tables for various object types. It's also possible to use the classical read/write paradigm and use the only one table with conflicts defined for the read and write operations. TransactionConflict: An ignore-conflict relationship can be created by a transaction for an object it has acquired. Then, even two operations op1 and op2 are conflicting according to a conflict table, if a transaction t1 that holds a lock op1 on an object obj created an ignore-conflict relationship with another transaction t2 to ignore conflict between op1 and op2 on obj, then t2 can get the lock op2 on obj.


Method Summary
 void addConflictTable(java.lang.Class cl, ConflictTable cTable)
          Add a new conflict table.
 void addConflictTable(java.lang.Object obj, ConflictTable cTable)
          Add a new conflict table.
 void addIgnoreConflict(TransactionConflict txConflict)
          Add a new ignore-conflict relationship.
 Conflict getConflict(BasicTransaction holdTx, BasicTransaction requestTx, java.lang.String holdOperation, java.lang.String requestOperation, java.lang.Object obj)
          Get conflict.
 void removeConflictTable(java.lang.Class cl, ConflictTable cTable)
          Remove a conflict table associated with the given type.
 void removeConflictTable(java.lang.Object obj, ConflictTable cTable)
          Remove a conflict table associated with the given object.
 void removeIgnoreConflict(TransactionConflict txConflict)
          Remove given ignore-connflict relationship.
 

Method Detail

addConflictTable

public void addConflictTable(java.lang.Class cl,
                             ConflictTable cTable)
Add a new conflict table. The conflict table will be used for any object of the given type.

Parameters:
cl - type of objects to apply the conflict table
cTable - conflict table

addConflictTable

public void addConflictTable(java.lang.Object obj,
                             ConflictTable cTable)
Add a new conflict table. The conflict table will be used for the specified object.

Parameters:
obj - object to apply the conflict table
cTable - conflict table

removeConflictTable

public void removeConflictTable(java.lang.Class cl,
                                ConflictTable cTable)
Remove a conflict table associated with the given type.

Parameters:
cl - type of objects the conflict table is applied to
cTable - conflict table

removeConflictTable

public void removeConflictTable(java.lang.Object obj,
                                ConflictTable cTable)
Remove a conflict table associated with the given object.

Parameters:
obj - object the conflict table is applied to
cTable - conflict table

addIgnoreConflict

public void addIgnoreConflict(TransactionConflict txConflict)
                       throws InvalidConflictException
Add a new ignore-conflict relationship. The method set ignore-conflict relationship between two transaction on given object. After the method invocation, conflict on the given object operations is not determined by the conflict table but by the given conflict value. In fact, the method allows to set the given operations as both conflicting or non-conflicting, redefine conflcit handler and implied dependency.

Parameters:
txConflict - ignore-conflict relationship to be added
Throws:
InvalidConflicException - operations do not match the object
InvalidConflictException

removeIgnoreConflict

public void removeIgnoreConflict(TransactionConflict txConflict)
Remove given ignore-connflict relationship.

Parameters:
txConflict - ignore-conflict relationship to be removed

getConflict

public Conflict getConflict(BasicTransaction holdTx,
                            BasicTransaction requestTx,
                            java.lang.String holdOperation,
                            java.lang.String requestOperation,
                            java.lang.Object obj)
Get conflict. The method returns conflict for given two transactions, two operations, and an object.

Parameters:
holdTx - transaction holding a lock on the object
requestTx - transaction requesting a lock on the object
holdOperation - operation (lock type) beeing held
requestOperation - operation (lock type) beeing requested
obj - object to share
Returns:
conflict record