Package com.persistit

Examples of com.persistit.Transaction


        synchronized (this) {
            sessionId = getSessionId();
        }
        assign();
        Preconditions.checkNotNull(sessionId);
        Transaction tx = db.getTransaction();
        assert sessionId == tx.getSessionId();

        try {
            tx.begin();
        } catch (PersistitException ex) {
            throw new PermanentStorageException(ex);
        }
    }
View Full Code Here


    @Override
    public void rollback() throws StorageException {
        super.rollback();
        synchronized (this) {
            assign();
            Transaction tx = db.getTransaction();
            if (tx.isActive() && !tx.isCommitted()) {
                tx.rollback();
            }
            tx.end();
            close();
        }
    }
View Full Code Here

                log.warn("Can't commit {}: already closed, trace to redundant commit follows", this, new IllegalStateException("redundant commit"));
                return;
            }
            super.commit();
            assign();
            Transaction tx = db.getTransaction();
            int retries = 3;
            try {
                if (tx.isActive() && !tx.isRollbackPending()) {
                    int i = 0;
                    while (true) {
                        try {
                            tx.commit(Transaction.CommitPolicy.HARD);
                            tx.end();
                            break;
                        } catch (RollbackException ex) {
                            if (i++ >= retries) {
                                throw ex;
                            }
View Full Code Here

        this.treeService = treeService;
    }

    @Override
    public boolean isTransactionActive(Session session) {
        Transaction txn = getTransaction(session);
        return (txn != null) && txn.isActive();
    }
View Full Code Here

        return (txn != null) && txn.isActive();
    }

    @Override
    public boolean isRollbackPending(Session session) {
        Transaction txn = getTransaction(session);
        return (txn != null) && txn.isRollbackPending();
    }
View Full Code Here

        return (txn != null) && txn.isRollbackPending();
    }

    @Override
    public long getTransactionStartTimestamp(Session session) {
        Transaction txn = getTransaction(session);
        requireActive(txn);
        return txn.getStartTimestamp();
    }
View Full Code Here

        return txn.getStartTimestamp();
    }

    @Override
    public void beginTransaction(Session session) {
        Transaction txn = getTransaction(session);
        requireInactive(txn); // Do not want to use Persistit nesting
        try {
            txn.begin();
            if(commitAfterMillis != NO_START_MILLIS) {
                session.put(START_MILLIS_KEY, System.currentTimeMillis());
            }
        } catch(PersistitException e) {
            PersistitAdapter.handlePersistitException(session, e);
View Full Code Here

        };
    }

    @Override
    public void commitTransaction(Session session) {
        Transaction txn = getTransaction(session);
        requireActive(txn);
        commitInternal(session, txn, false, true);
    }
View Full Code Here

        commitInternal(session, txn, false, true);
    }

    @Override
    public boolean commitOrRetryTransaction(Session session) {
        Transaction txn = getTransaction(session);
        requireActive(txn);
        return commitInternal(session, txn, true, true);
    }
View Full Code Here

        return commitInternal(session, txn, true, true);
    }

    @Override
    public void rollbackTransaction(Session session) {
        Transaction txn = getTransaction(session);
        requireActive(txn);
        RuntimeException re = null;
        try {
            txn.rollback();
            runCallbacks(session, AFTER_ROLLBACK_KEY, -1, null);
        } catch(RuntimeException e) {
            re = e;
        } finally {
            end(session, txn, true, re);
View Full Code Here

TOP

Related Classes of com.persistit.Transaction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.