Transaction Concepts

Note: Before reading further be sure to read the introductory tutorial.

Beginning with version 1.1 the Commons Transaction package features extended transaction support mechanisms. They are grouped around the new lock manager and its implementation that should be used as the only interface to access locks associated to some sort of transaction. To do so it offers you locking methods like lock and tryLock.

It is important for this manager to be central and have knowledge of all locking operations to perform tasks like deadlock detection, incorporate global transaction timeouts and add convenience methods to release all locks of a transaction.

Additional to the preference feature in the new lock, its implementation has some internal means to record all requests that wait for (partially) acquiring a lock in the sequence they occur. This is used by the deadlock detection in the lock manager. Another possible use is in custom implementations of fair scheduling lock mechanisms. Even though the specific protected methods registerWaiter and unregisterWaiter and field waitingOwners are not made available through interfaces subclasses can still use them and even make their means public.