Package net.sf.ehcache.transaction

Examples of net.sf.ehcache.transaction.TransactionID


    /**
     * Begin a new transaction with the specified timeout and bind its context to the current thread
     * @param transactionTimeoutSeconds the timeout foe this transaction in seconds
     */
    public void begin(int transactionTimeoutSeconds) {
        TransactionID txId = currentTransactionIdThreadLocal.get();
        if (txId != null) {
            throw new TransactionException("transaction already started");
        }

        LocalTransactionContext newTx = new LocalTransactionContext(transactionTimeoutSeconds, transactionIDFactory.createTransactionID());
View Full Code Here


     * Commit the transaction bound to the current thread, ignoring if the transaction
     * timed out
     * @param ignoreTimeout true if the transaction should be committed no matter if it timed out or not
     */
    public void commit(boolean ignoreTimeout) {
        TransactionID txId = currentTransactionIdThreadLocal.get();
        if (txId == null) {
            throw new TransactionException("no transaction started");
        }

        LocalTransactionContext currentTx = contextMap.get(txId);
View Full Code Here

    /**
     * Rollback the transaction bound to the current thread
     */
    public void rollback() {
        TransactionID txId = currentTransactionIdThreadLocal.get();
        if (txId == null) {
            throw new TransactionException("no transaction started");
        }

        LocalTransactionContext currentTx = contextMap.get(txId);
View Full Code Here

    /**
     * Mark the transaction bound to the current thread for rollback only
     */
    public void setRollbackOnly() {
        TransactionID txId = currentTransactionIdThreadLocal.get();
        if (txId == null) {
            throw new TransactionException("no transaction started");
        }

        LocalTransactionContext currentTx = contextMap.get(txId);
View Full Code Here

     * Get the transaction context bond to the current thread
     * @return the transaction context bond to the current thread or null if no transaction
     *      started on the current thread         
     */
    public LocalTransactionContext getCurrentTransactionContext() {
        TransactionID txId = currentTransactionIdThreadLocal.get();
        if (txId == null) {
            return null;
        }
        return contextMap.get(txId);
    }
View Full Code Here

TOP

Related Classes of net.sf.ehcache.transaction.TransactionID

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.