Examples of Txn


Examples of com.ponysdk.core.stm.Txn

        if (UIContext.get() == null) {
            begin();
            try {
                if (listenerCollection.isEmpty()) return;
                final Txn txn = Txn.get();
                txn.begin(txnContext);
                try {
                    for (final Object data : collection) {
                        for (final DataListener listener : listenerCollection) {
                            listener.onData(data);
                        }
                    }
                    txn.commit();
                } catch (final Throwable e) {
                    log.error("Cannot process open socket", e);
                    txn.rollback();
                }
            } finally {
                end();
            }
        } else {
View Full Code Here

Examples of com.sleepycat.je.txn.Txn

            /* No environment level defaults applied. */
            if (useConfig == null) {
                useConfig = txnConfig;
            }
        }
        Txn internalTxn = envImpl.txnBegin(parent, useConfig);
        Transaction txn = new Transaction(this, internalTxn);
        addReferringHandle(txn);
        return txn;
    }
View Full Code Here

Examples of com.sleepycat.je.txn.Txn

     * Used to get the Transaction object given an XA Xid.
     * @hidden
     * Internal use only.
     */
    public Transaction getXATransaction(Xid xid) {
        Txn ret = getXATransactionInternal(xid);
        if (ret == null ||
            ret instanceof PreparedTxn) {
            return null;
        }

View Full Code Here

Examples of com.sleepycat.je.txn.Txn

            return;
        }

        try {
            checkEnv();
            Txn txn = getXATransactionInternal(xid);
            if (txn == null) {
                throw new XAException
                    ("No transaction found for " + xid + " during commit.");
            }
            removeReferringHandle(new Transaction(this, txn));
            if (txn.isOnlyAbortable()) {
                throw new XAException(XAException.XA_RBROLLBACK);
            }
            txn.commit(xid);
        } catch (DatabaseException DE) {
            throwNewXAException(DE);
        }
        if (DEBUG) {
            System.out.println("*** commit finished");
View Full Code Here

Examples of com.sleepycat.je.txn.Txn

                 envImpl.getTxnManager().getTxnForThread());
        }

        Transaction transaction =
            envImpl.getTxnManager().unsetTxnForThread();
        Txn txn;
        if (transaction == null) {
            transaction = getXATransaction(xid);
            boolean nullTransaction = (transaction == null);
            txn = !nullTransaction ? transaction.getTxn() : null;
            boolean isSuspended = !nullTransaction &&
                (txn != null) &&
                txn.isSuspended();
            if (!isSuspended) {
                throw new XAException(XAException.XAER_NOTA);
            }
        } else {
            txn = transaction.getTxn();
        }

        if (tmFail) {

            /*
             * Creating the XAFailureException will set the txn to abort-only.
             * This exception stack trace will provide more "cause" information
             * when it is wrapped in an exception that is thrown later, which
             * occurs when an attempt is made to use the txn.
             */
            new XAFailureException(txn);
        }

        if (tmSuspend && txn != null) {
            txn.setSuspended(true);
        }
    }
View Full Code Here

Examples of com.sleepycat.je.txn.Txn

            System.out.println("*** rollback called");
        }

        try {
            checkEnv();
            Txn txn = getXATransactionInternal(xid);
            if (txn == null) {
                throw new XAException
                    ("No transaction found for " + xid + " during rollback.");
            }
            removeReferringHandle(new Transaction(this, txn));
            txn.abort(xid);
        } catch (DatabaseException DE) {
            throwNewXAException(DE);
        }

        if (DEBUG) {
View Full Code Here

Examples of com.sleepycat.je.txn.Txn

        throws DatabaseException {

        super.close(isCommit);

        if (activeTxns != null) {
            Txn removed = activeTxns.remove(getId());
            assert removed != null : "txn was not in map " + this + " " +
                LoggerUtils.getStackTrace();
        }
    }
View Full Code Here

Examples of com.sleepycat.je.txn.Txn

        TransactionConfig txnConfig = new TransactionConfig();
        txnConfig.setDurability(READ_ONLY.getDurability());
        txnConfig.setConsistencyPolicy(policy);
        txnConfig.setReadUncommitted(true);

        Txn txn = null;
        try {
            txn = new ReadonlyTxn(rImpl, txnConfig);
            RepGroupImpl group = fetchGroup(groupName, dbImpl, txn);
            /* Correct summary info since we are reading uncommitted data */
            group.makeConsistent();
            txn.commit();
            txn = null;

            return group;
        } finally {
            if (txn != null) {
                txn.abort();
            }
        }
    }
View Full Code Here

Examples of com.sleepycat.je.txn.Txn

        /* Create the common group entry. */
        TransactionConfig txnConfig = new TransactionConfig();
        txnConfig.setDurability(NO_ACK.getDurability());
        txnConfig.setConsistencyPolicy(NO_CONSISTENCY);
        Txn txn = null;
        Cursor cursor = null;
        try {
            txn = new MasterTxn(repImpl,
                                txnConfig,
                                repImpl.getNameIdPair());

            cursor = makeCursor(groupDbImpl, txn, CursorConfig.DEFAULT);
            OperationStatus status = cursor.put(groupKeyEntry, groupEntry);
            if (status != OperationStatus.SUCCESS) {
                throw EnvironmentFailureException.unexpectedState
                    ("Couldn't write first group entry " + status);
            }
            cursor.close();
            cursor = null;
            txn.commit();
            txn = null;
        } finally {
            if (cursor != null) {
                cursor.close();
            }

            if (txn != null) {
                txn.abort();
            }
        }

        ensureMember(new RepNodeImpl(nodeName,
                                     repImpl.getHostName(),
View Full Code Here

Examples of com.sleepycat.je.txn.Txn

        StringBinding.stringToEntry(ensureNode.getName(), nodeNameKey);

        DatabaseEntry value = new DatabaseEntry();
        final RepGroupDB.NodeBinding mib = new RepGroupDB.NodeBinding();

        Txn txn = null;
        Cursor cursor = null;
        try {
            txn = new ReadonlyTxn(repImpl, NO_ACK);
            CursorConfig config = new CursorConfig();
            config.setReadCommitted(true);
            cursor = makeCursor(groupDbImpl, txn, config);

            OperationStatus status =
                cursor.getSearchKey(nodeNameKey, value, null);
            if (status == OperationStatus.SUCCESS) {
                /* Let's see if the entry needs updating. */
                RepNodeImpl miInDb = mib.entryToObject(value);
                if (miInDb.equivalent(ensureNode)) {
                    if (miInDb.isQuorumAck()) {
                        /* Present, matched and acknowledged. */
                        return;
                    }
                    ensureNode.getNameIdPair().update(miInDb.getNameIdPair());
                    /* Not acknowledged, retry the update. */
                } else {
                    /* Present but not equivalent. */
                    LoggerUtils.warning(logger, repImpl,
                                        "Incompatible node descriptions. " +
                                        "Membership database definition: " +
                                        miInDb.toString() +
                                        " Transient definition: " +
                                        ensureNode.toString());
                    throw EnvironmentFailureException.unexpectedState
                        ("Incompatible node descriptions for node ID: " +
                         ensureNode.getNodeId());
                }
                LoggerUtils.info(logger, repImpl,
                                 "Present but not ack'd node: " +
                                 ensureNode.getNodeId() +
                                 " ack status: " + miInDb.isQuorumAck());
            }
            cursor.close();
            cursor = null;
            txn.commit();
            txn = null;
        } finally {
            if (cursor != null) {
                cursor.close();
            }

            if (txn != null) {
                txn.abort();
            }

        }
        createMember(ensureNode);

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.