Package org.modeshape.jcr.txn

Examples of org.modeshape.jcr.txn.Transactions$SimpleTransaction


        return this;
    }

    private <V> V runInTransaction( Callable<V> operation ) {
        // Start a transaction ...
        Transactions txns = sessionContext.getTransactions();
        try {
            Transaction txn = txns.begin();
            try {
                V result = operation.call();
                txn.commit();
                return result;
            } catch (Exception e) {
View Full Code Here


     * shared workspace cache.
     */
    @Override
    public void checkForTransaction() {
        try {
            Transactions transactions = sessionContext.getTransactions();
            Transaction txn = transactions.getTransactionManager().getTransaction();
            if (txn != null && txn.getStatus() == Status.STATUS_ACTIVE) {
                // There is an active transaction, so we need a transaction-specific workspace cache ...
                workspaceCache.set(sessionContext.getTransactionalWorkspaceCacheFactory()
                                                 .getTransactionalWorkspaceCache(sharedWorkspaceCache));
                // only register the function if there's an active ModeShape transaction because we need to run the
                // function *only after* ISPN has committed its transaction & updated the cache
                // if there isn't an active ModeShape transaction, one will become active later during "save"
                // otherwise, "save" is never called meaning this cache should be discarded
                Transactions.Transaction modeshapeTx = transactions.currentTransaction();
                if (modeshapeTx != null) {
                    if (this.completeTransactionFunction.get() == null) {
                        // create and register the complete transaction function only once
                        this.completeTransactionFunction.compareAndSet(null, new Transactions.TransactionFunction() {
                            @Override
View Full Code Here

TOP

Related Classes of org.modeshape.jcr.txn.Transactions$SimpleTransaction

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.