8 Replies Latest reply on Nov 9, 2005 7:52 AM by Manik Surtani

    TxInterceptor and 1-phase commits

    Manik Surtani Master

      As a part of the refactoring process for JBossCache 1.3, I've genericised the OptimisticTxInterceptor (which created tx's as needed and handled synchronizations for tx completion) so that it is the starting point of *all* interceptor chains and handles all transactional aspects of the cache.

      This has greatly simplified the ReplicationInterceptor, the new InvalidationInterceptor, Unlock- and PessimisticLockInterceptors.

      As a part of this, I've noticed the following:

      * Optimistic chain always uses 2-phase commits.
      * Pessimistic chain uses 1-phase commits when replication mode is asynchronous.

      Is the latter necessary? Could we move to a 2PC mechanism for the pess. locking/async. replication scenario?

      The way this is handled in the case of opt. locking/async. replication is that the prepare phase is always synchronous, it is just the commit phase that we run asynchronously.

      I feel that by using 2PC throughout, we'd greatly simplify the interceptors even further. The drawback, of course, is that the prepare phase will always be synchronous. What are peoples' thoughts around this? Does this altogether beat the purpose of async replication?