1. /*
  2. * Copyright 2002 Sun Microsystems, Inc. All rights reserved.
  3. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  4. */
  5. package javax.resource.cci;
  6. import javax.resource.ResourceException;
  7. /** The LocalTransaction defines a transaction demarcation interface for
  8. * resource manager local transactions. Note that this interface is
  9. * used for application level local transaction demarcation. The
  10. * system contract level LocalTransaction interface (as defined in
  11. * the <code>javax.resource.spi</code> package) is used by the container
  12. * for local transaction management.
  13. *
  14. * <p>A local transaction is managed internal to a resource manager. There
  15. * is no external transaction manager involved in the coordination of
  16. * such transactions.
  17. *
  18. * <p>A CCI implementation can (but is not required to) implement the
  19. * LocalTransaction interface. If the LocalTransaction interface is supported
  20. * by a CCI implementation, then the method
  21. * <code>Connection.getLocalTransaction</code> should return a
  22. * LocalTransaction instance. A component can then use the
  23. * returned LocalTransaction to demarcate a resource manager local transaction
  24. * (associated with the Connection instance) on the underlying EIS
  25. * instance.
  26. *
  27. * @author Rahul Sharma
  28. * @since 0.8
  29. * @see javax.resource.cci.Connection
  30. **/
  31. public interface LocalTransaction {
  32. /** Begins a local transaction on an EIS instance.
  33. *
  34. * @throws ResourceException Failed to begin a local
  35. * transaction. Examples of
  36. * error cases are:
  37. * <UL>
  38. * <LI>Resource adapter internal or EIS-specific
  39. * error
  40. * <LI>Connection is already participating in a
  41. * local or JTA transaction
  42. * </UL>
  43. **/
  44. public
  45. void begin() throws ResourceException;
  46. /** Commits the current local transaction and release all locks held
  47. * by the underlying EIS instance.
  48. *
  49. * @throws ResourceException Failed to commit a local
  50. * transaction. Examples of
  51. * error cases are:
  52. * <UL>
  53. * <LI> Resource adapter internal or EIS-specific error
  54. * <LI> Violation of integrity constraints, deadlock
  55. * detection, communication failure during
  56. * transaction completion, or any retry requirement
  57. * <LI> Connection is participating in an active JTA
  58. * transaction
  59. * <LI> Invalid transaction context; commit
  60. * operation invoked without an active
  61. * transaction context
  62. * </UL>
  63. **/
  64. public
  65. void commit() throws ResourceException;
  66. /** Rollbacks the current resource manager local transaction.
  67. *
  68. * @throws ResourceException Failed to rollback a local
  69. * transaction. Examples of
  70. * error cases are:
  71. * <UL>
  72. * <LI> Resource adapter internal or EIS-specific error
  73. * <LI> Connection is participating in an active JTA
  74. * transaction
  75. * <LI> Invalid transaction context; rollback
  76. * operation invoked without an active
  77. * transaction context
  78. * </UL>
  79. **/
  80. public
  81. void rollback() throws ResourceException;
  82. }