KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > oracle > toplink > essentials > transaction > JTASynchronizationListener


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
5  * in compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * glassfish/bootstrap/legal/CDDLv1.0.txt or
9  * https://glassfish.dev.java.net/public/CDDLv1.0.html.
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 in each file and include the License file at
15  * glassfish/bootstrap/legal/CDDLv1.0.txt. If applicable,
16  * add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your
18  * own identifying information: Portions Copyright [yyyy]
19  * [name of copyright owner]
20  */

21 // Copyright (c) 1998, 2005, Oracle. All rights reserved.
22
package oracle.toplink.essentials.transaction;
23
24 import javax.transaction.Synchronization JavaDoc;
25 import oracle.toplink.essentials.internal.sessions.UnitOfWorkImpl;
26 import oracle.toplink.essentials.internal.sessions.AbstractSession;
27
28 /**
29  * <p>
30  * <b>Purpose</b>: Synchronization object implementation for JTA 1.0
31  * <p>
32  * <b>Description</b>: Instances of this class are registered against JTA 1.0
33  * transactions. This class may be subclassed to provide specialized behavior
34  * for specific transaction implementations. Subclasses must implement the
35  * newListener() method to return an instances of the listener subclass.
36  *
37  * @see JTATransactionController
38  */

39 public class JTASynchronizationListener extends AbstractSynchronizationListener implements Synchronization JavaDoc, SynchronizationListenerFactory {
40
41     /**
42      * PUBLIC:
43      * Used to create factory instances only. Use the "full-bodied" constructor
44      * for creating proper listener instances.
45      */

46     public JTASynchronizationListener() {
47         super();
48     }
49
50     /**
51      * INTERNAL:
52      * Constructor for creating listener instances (expects all required state info)
53      */

54     public JTASynchronizationListener(UnitOfWorkImpl unitOfWork, AbstractSession session, Object JavaDoc transaction, AbstractTransactionController controller) {
55         super(unitOfWork, session, transaction, controller);
56     }
57
58     /**
59      * INTERNAL:
60      * Create and return the Synchronization listener object that can be registered
61      * to receive JTA transaction notification callbacks.
62      */

63     public AbstractSynchronizationListener newSynchronizationListener(UnitOfWorkImpl unitOfWork, AbstractSession session, Object JavaDoc transaction, AbstractTransactionController controller) {
64         return new JTASynchronizationListener(unitOfWork, session, transaction, controller);
65     }
66
67     /**
68      * INTERNAL:
69      * Called by the JTA transaction manager prior to the start of the
70      * transaction completion process.
71      * This call is executed in the same transaction context of the caller
72      * who initiates the TransactionManager.commit, or the call is executed
73      * with no transaction context if Transaction.commit is used.
74      */

75     public void beforeCompletion() {
76         super.beforeCompletion();
77     }
78
79     /**
80      * INTERNAL:
81      * Called by the JTA transaction manager after the transaction is committed
82      * or rolled back. This method executes without a transaction context.
83      *
84      * @param stat The status of the transaction completion.
85      */

86     public void afterCompletion(int stat) {
87         super.afterCompletion(new Integer JavaDoc(stat));
88     }
89 }
90
Popular Tags