private synchronized boolean deleteIfAfter()

in src/main/java/com/amazonaws/services/dynamodbv2/transactions/Transaction.java [310:337]


    private synchronized boolean deleteIfAfter(Long deleteIfAfterMillis) throws TransactionException {
        if(! txItem.isCompleted()) {
            // Ensure we have an up to date tx record
            try {
                txItem = new TransactionItem(txId, txManager, false);
            } catch (TransactionNotFoundException e) {
                return true; // expected, transaction already deleted
            }
            if(! txItem.isCompleted()) {
                throw new TransactionException(txId, "You can only delete a transaction that is completed");
            }
        }
        try {
            if(deleteIfAfterMillis == null || (txItem.getLastUpdateTimeMillis() + deleteIfAfterMillis) < System.currentTimeMillis()) {
                txItem.delete();
                return true;
            }
        } catch (ConditionalCheckFailedException e) {
            // Can only happen if the tx isn't finalized or is already gone.
            try {
                txItem = new TransactionItem(txId, txManager, false);
                throw new TransactionException(txId, "Transaction was completed but could not be deleted. " + txItem);
            } catch (TransactionNotFoundException tnfe) {
                return true; // expected, transaction already deleted
            }
        }
        return false;
    }