KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > alfresco > repo > transaction > TransactionListener


1 /*
2  * Copyright (C) 2005 Alfresco, Inc.
3  *
4  * Licensed under the Mozilla Public License version 1.1
5  * with a permitted attribution clause. You may obtain a
6  * copy of the License at
7  *
8  * http://www.alfresco.org/legal/license.txt
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software distributed under the License is distributed on an
12  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
13  * either express or implied. See the License for the specific
14  * language governing permissions and limitations under the
15  * License.
16  */

17 package org.alfresco.repo.transaction;
18
19 /**
20  * Listener for Alfresco-specific transaction callbacks.
21  *
22  * @see org.alfresco.repo.transaction.AlfrescoTransactionSupport
23  *
24  * @author Derek Hulley
25  */

26 public interface TransactionListener
27 {
28     /**
29      * Allows the listener to flush any consuming resources. This mechanism is
30      * used primarily during long-lived transactions to ensure that system resources
31      * are not used up.
32      */

33     void flush();
34     
35     /**
36      * Called before a transaction is committed.
37      * <p>
38      * All transaction resources are still available.
39      *
40      * @param readOnly true if the transaction is read-only
41      */

42     void beforeCommit(boolean readOnly);
43     
44     /**
45      * Invoked before transaction commit/rollback. Will be called after
46      * {@link #beforeCommit(boolean) } even if {@link #beforeCommit(boolean)}
47      * failed.
48      * <p>
49      * Any exceptions generated here will cause the transaction to rollback.
50      * <p>
51      * All transaction resources are still available.
52      */

53     void beforeCompletion();
54     
55     /**
56      * Invoked after transaction commit.
57      * <p>
58      * Any exceptions generated here will cause the transaction to rollback.
59      * <p>
60      * Although all transaction resources are still available, this method should
61      * be used only for cleaning up resources after a commit has occured.
62      */

63     void afterCommit();
64
65     /**
66      * Invoked after transaction rollback.
67      * <p>
68      * Although all transaction resources are still available, this method should
69      * be used only for cleaning up resources after a rollback has occured.
70      */

71     void afterRollback();
72 }
73
Popular Tags