~pbeaman/akiban-persistit/fix-hard-commit-infinite-loop

« back to all changes in this revision

Viewing changes to src/main/java/com/persistit/Transaction.java

merge pbeaman: Fixes bug 1032701 - Interrupt causes Thread to exit without releasing claims.

https://code.launchpad.net/~pbeaman/akiban-persistit/fix-1032701-interrupts-leave-latches/+merge/118253

Show diffs side-by-side

added added

removed removed

Lines of Context:
586
586
        if (_commitCompleted) {
587
587
            throw new IllegalStateException("Attempt to begin a committed transaction " + this);
588
588
        }
 
589
        if (_rollbackPending) {
 
590
            throw new IllegalStateException("Attempt to begin a transaction with pending rollback" + this);
 
591
        }
589
592
        if (_nestedDepth == 0) {
590
593
            flushTransactionBuffer(false);
591
594
            try {
592
595
                _transactionStatus = _persistit.getTransactionIndex().registerTransaction();
593
596
            } catch (InterruptedException e) {
 
597
                _rollbackCompleted = true;
594
598
                throw new PersistitInterruptedException(e);
595
599
            }
596
600
            _rollbackPending = false;
609
613
        if (_commitCompleted) {
610
614
            throw new IllegalStateException("Attempt to begin a committed transaction " + this);
611
615
        }
 
616
        if (_rollbackPending) {
 
617
            throw new IllegalStateException("Attmpet to begin a transaction with pending rollback" + this);
 
618
        }
612
619
        if (_nestedDepth == 0) {
613
620
            flushTransactionBuffer(false);
614
621
            try {
615
622
                _transactionStatus = _persistit.getTransactionIndex().registerCheckpointTransaction();
616
623
            } catch (InterruptedException e) {
 
624
                _rollbackCompleted = true;
617
625
                throw new PersistitInterruptedException(e);
618
626
            }
619
627
            _rollbackPending = false;
854
862
                        policy == CommitPolicy.GROUP ? _persistit.getTransactionCommitStallTime() : 0);
855
863
                committed = true;
856
864
            } finally {
 
865
                
857
866
                _persistit.getTransactionIndex().notifyCompleted(_transactionStatus,
858
867
                        committed ? _commitTimestamp : TransactionStatus.ABORTED);
859
868
                _commitCompleted = committed;
860
 
                _rollbackCompleted = !committed;
 
869
                _rollbackPending = _rollbackCompleted = !committed;
861
870
            }
862
871
        }
863
872
    }