View Javadoc

1   /*
2    * Copyright (C) The Apache Software Foundation. All rights reserved.
3    *
4    * This software is published under the terms of the Apache Software License
5    * version 1.1, a copy of which has been included with this distribution in
6    * the LICENSE file.
7    * 
8    * $Id: XACapable.java 155459 2005-02-26 13:24:44Z dirkv $
9    */
10  package org.apache.commons.messenger;
11  
12  import javax.transaction.Transaction;
13  
14  /** 
15   * <p><code>XACapable</code> is an object (typically a MessageListener in this context)
16   * which can be part of an XA transaction.
17   * This just means that this object has a way of providing XA resources.</p>
18   *
19   * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
20   * @version $Revision: 155459 $
21   */
22  public interface XACapable {
23  
24  	/**
25  	 * This method is called to enlist any XA resources the given object 
26  	 * has to be part of the XA transaction.
27  	 * 
28  	 * @param transaction the transaction to enlist to 
29  	 */	
30  	public void enlistResources(Transaction transaction) throws Exception;
31  
32  	/**
33  	 * This method is called to delist any XA resources the given object 
34  	 * has previously enlisted to this XA transaction.
35  	 * 
36  	 * @param transaction the transaction to delist resources from
37  	 * @param flag is the flag used by JTA when delisting resources.
38  	 * It is either XAResource.TMSUCCESS, XAResource.TMSUSPEND, or XAResource.TMFAIL
39  	 */	
40  	public void delistResources(Transaction transaction, int flag) throws Exception;
41  }
42