📄 transaction.vm
字号:
/* * $Id: Transaction.vm 10621 2008-01-30 12:15:16Z dirk.olmes $ * -------------------------------------------------------------------------------------- * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com * * The software in this package is published under the terms of the CPAL v1.0 * license, a copy of which has been included with this distribution in the * LICENSE.txt file. */package org.mule.transport.${TransportNameLower};import org.mule.api.transaction.TransactionException;import org.mule.transaction.AbstractSingleResourceTransaction;/** * <code>${TransportName}Transaction</code> is a wrapper for a * ${TransportName} local transaction. This object holds the tx resource and * controls the when the transaction committed or rolled back. * */public class ${TransportName}Transaction extends AbstractSingleResourceTransaction{ /* For general guidelines on writing transports see http://mule.mulesource.org/display/MULE/Writing+Transports */ public void bindResource(Object key, Object resource) throws TransactionException { /* IMPLEMENTATION NOTE: Validate as necessary, the resource here and then pass it to the super class to bind it to the key and also do any other specific binding here. eg. try { // TODO Validate Resource state here if necessary } catch (XXXException e) { throw new IllegalTransactionStateException(new Message(Messages.TX_CANT_READ_STATE), e); } */ super.bindResource(key, resource); } protected void doBegin() throws TransactionException { /* IMPLEMENTATION NOTE: Sometimes the resource has already begun the transaction when its been made available i.e. A transacted Jms Session doesn't have a .begin() method, because initiation is handled by the Jms provider. eg. try { // TODO begin transaction - i.e. <resource>.begin(); } catch (XXXException e) { throw new TransactionException(new Message(Messages.TX_COMMIT_FAILED), e); } */ } protected void doCommit() throws TransactionException { /* IMPLEMENTATION NOTE: Commit the transaction here. Throw an appropriate TransactionException on failure. eg. try { // TODO commit transaction - i.e. <resource>.commit(); } catch (XXXException e) { throw new TransactionException(new Message(Messages.TX_COMMIT_FAILED), e); } */ } protected void doRollback() throws TransactionException { /* IMPLEMENTATION NOTE: Rollback the transaction here. Throw an appropriate TransactionException on failure. eg, try { // TODO rollback transaction - i.e. <resource>.rollback(); } catch (XXXException e) { throw new TransactionException(new Message(Messages.TX_ROLLBACK_FAILED), e); } */ }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -