1 /* 2 * The contents of this file are subject to the terms 3 * of the Common Development and Distribution License 4 * (the License). You may not use this file except in 5 * compliance with the License. 6 * 7 * You can obtain a copy of the license at 8 * https://glassfish.dev.java.net/public/CDDLv1.0.html or 9 * glassfish/bootstrap/legal/CDDLv1.0.txt. 10 * See the License for the specific language governing 11 * permissions and limitations under the License. 12 * 13 * When distributing Covered Code, include this CDDL 14 * Header Notice in each file and include the License file 15 * at glassfish/bootstrap/legal/CDDLv1.0.txt. 16 * If applicable, add the following below the CDDL Header, 17 * with the fields enclosed by brackets [] replaced by 18 * you own identifying information: 19 * "Portions Copyrighted [year] [name of copyright owner]" 20 * 21 * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 22 */ 23 24 package javax.resource.cci; 25 26 import javax.resource.ResourceException; 27 /** The LocalTransaction defines a transaction demarcation interface for 28 * resource manager local transactions. Note that this interface is 29 * used for application level local transaction demarcation. The 30 * system contract level LocalTransaction interface (as defined in 31 * the <code>javax.resource.spi</code> package) is used by the container 32 * for local transaction management. 33 * 34 * <p>A local transaction is managed internal to a resource manager. There 35 * is no external transaction manager involved in the coordination of 36 * such transactions. 37 * 38 * <p>A CCI implementation can (but is not required to) implement the 39 * LocalTransaction interface. If the LocalTransaction interface is supported 40 * by a CCI implementation, then the method 41 * <code>Connection.getLocalTransaction</code> should return a 42 * LocalTransaction instance. A component can then use the 43 * returned LocalTransaction to demarcate a resource manager local transaction 44 * (associated with the Connection instance) on the underlying EIS 45 * instance. 46 * 47 * @author Rahul Sharma 48 * @since 0.8 49 * @see javax.resource.cci.Connection 50 **/ 51 52 public interface LocalTransaction { 53 54 /** Begins a local transaction on an EIS instance. 55 * 56 * @throws ResourceException Failed to begin a local 57 * transaction. Examples of 58 * error cases are: 59 * <UL> 60 * <LI>Resource adapter internal or EIS-specific 61 * error 62 * <LI>Connection is already participating in a 63 * local or JTA transaction 64 * </UL> 65 **/ 66 public 67 void begin() throws ResourceException; 68 69 70 /** Commits the current local transaction and release all locks held 71 * by the underlying EIS instance. 72 * 73 * @throws ResourceException Failed to commit a local 74 * transaction. Examples of 75 * error cases are: 76 * <UL> 77 * <LI> Resource adapter internal or EIS-specific error 78 * <LI> Violation of integrity constraints, deadlock 79 * detection, communication failure during 80 * transaction completion, or any retry requirement 81 * <LI> Connection is participating in an active JTA 82 * transaction 83 * <LI> Invalid transaction context; commit 84 * operation invoked without an active 85 * transaction context 86 * </UL> 87 **/ 88 public 89 void commit() throws ResourceException; 90 91 /** Rollbacks the current resource manager local transaction. 92 * 93 * @throws ResourceException Failed to rollback a local 94 * transaction. Examples of 95 * error cases are: 96 * <UL> 97 * <LI> Resource adapter internal or EIS-specific error 98 * <LI> Connection is participating in an active JTA 99 * transaction 100 * <LI> Invalid transaction context; rollback 101 * operation invoked without an active 102 * transaction context 103 * </UL> 104 105 **/ 106 public 107 void rollback() throws ResourceException; 108 } 109