Source Code Cross Referenced for TransactionSynchronization.java in  » J2EE » spring-framework-2.5 » org » springframework » transaction » support » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.5 » org.springframework.transaction.support 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002-2007 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.springframework.transaction.support;
018:
019:        /**
020:         * Interface for transaction synchronization callbacks.
021:         * Supported by AbstractPlatformTransactionManager.
022:         *
023:         * <p>TransactionSynchronization implementations can implement the Ordered interface
024:         * to influence their execution order. A synchronization that does not implement the
025:         * Ordered interface is appended to the end of the synchronization chain.
026:         *
027:         * <p>System synchronizations performed by Spring itself use specific order values,
028:         * allowing for fine-grained interaction with their execution order (if necessary).
029:         *
030:         * @author Juergen Hoeller
031:         * @since 02.06.2003
032:         * @see TransactionSynchronizationManager
033:         * @see AbstractPlatformTransactionManager
034:         * @see org.springframework.jdbc.datasource.DataSourceUtils#CONNECTION_SYNCHRONIZATION_ORDER
035:         * @see org.springframework.orm.hibernate3.SessionFactoryUtils#SESSION_SYNCHRONIZATION_ORDER
036:         */
037:        public interface TransactionSynchronization {
038:
039:            /** Completion status in case of proper commit */
040:            int STATUS_COMMITTED = 0;
041:
042:            /** Completion status in case of proper rollback */
043:            int STATUS_ROLLED_BACK = 1;
044:
045:            /** Completion status in case of heuristic mixed completion or system errors */
046:            int STATUS_UNKNOWN = 2;
047:
048:            /**
049:             * Suspend this synchronization.
050:             * Supposed to unbind resources from TransactionSynchronizationManager if managing any.
051:             * @see TransactionSynchronizationManager#unbindResource
052:             */
053:            void suspend();
054:
055:            /**
056:             * Resume this synchronization.
057:             * Supposed to rebind resources to TransactionSynchronizationManager if managing any.
058:             * @see TransactionSynchronizationManager#bindResource
059:             */
060:            void resume();
061:
062:            /**
063:             * Invoked before transaction commit (before "beforeCompletion").
064:             * Can e.g. flush transactional O/R Mapping sessions to the database.
065:             * <p>This callback does <i>not</i> mean that the transaction will actually be committed.
066:             * A rollback decision can still occur after this method has been called. This callback
067:             * is rather meant to perform work that's only relevant if a commit still has a chance
068:             * to happen, such as flushing SQL statements to the database.
069:             * <p>Note that exceptions will get propagated to the commit caller and cause a
070:             * rollback of the transaction.
071:             * @param readOnly whether the transaction is defined as read-only transaction
072:             * @throws RuntimeException in case of errors; will be <b>propagated to the caller</b>
073:             * (note: do not throw TransactionException subclasses here!)
074:             * @see #beforeCompletion
075:             */
076:            void beforeCommit(boolean readOnly);
077:
078:            /**
079:             * Invoked before transaction commit/rollback.
080:             * Can perform resource cleanup <i>before</i> transaction completion.
081:             * <p>This method will be invoked after <code>beforeCommit</code>, even when
082:             * <code>beforeCommit</code> threw an exception. This callback allows for
083:             * closing resources before transaction completion, for any outcome.
084:             * @throws RuntimeException in case of errors; will be <b>logged but not propagated</b>
085:             * (note: do not throw TransactionException subclasses here!)
086:             * @see #beforeCommit
087:             * @see #afterCompletion
088:             */
089:            void beforeCompletion();
090:
091:            /**
092:             * Invoked after transaction commit. Can perform further operations right
093:             * <i>after</i> the main transaction has <i>successfully</i> committed.
094:             * <p>Can e.g. commit further operations that are supposed to follow on a successful
095:             * commit of the main transaction, like confirmation messages or emails.
096:             * <p><b>NOTE:</b> The transaction will have been committed already, but the
097:             * transactional resources might still be active and accessible. As a consequence,
098:             * any data access code triggered at this point will still "participate" in the
099:             * original transaction, allowing to perform some cleanup (with no commit following
100:             * anymore!), unless it explicitly declares that it needs to run in a separate
101:             * transaction. Hence: <b>Use <code>PROPAGATION_REQUIRES_NEW</code> for any
102:             * transactional operation that is called from here.</b>
103:             * @throws RuntimeException in case of errors; will be <b>propagated to the caller</b>
104:             * (note: do not throw TransactionException subclasses here!)
105:             */
106:            void afterCommit();
107:
108:            /**
109:             * Invoked after transaction commit/rollback.
110:             * Can perform resource cleanup <i>after</i> transaction completion.
111:             * <p><b>NOTE:</b> The transaction will have been committed or rolled back already,
112:             * but the transactional resources might still be active and accessible. As a
113:             * consequence, any data access code triggered at this point will still "participate"
114:             * in the original transaction, allowing to perform some cleanup (with no commit
115:             * following anymore!), unless it explicitly declares that it needs to run in a
116:             * separate transaction. Hence: <b>Use <code>PROPAGATION_REQUIRES_NEW</code>
117:             * for any transactional operation that is called from here.</b>
118:             * @param status completion status according to the <code>STATUS_*</code> constants
119:             * @throws RuntimeException in case of errors; will be <b>logged but not propagated</b>
120:             * (note: do not throw TransactionException subclasses here!)
121:             * @see #STATUS_COMMITTED
122:             * @see #STATUS_ROLLED_BACK
123:             * @see #STATUS_UNKNOWN
124:             * @see #beforeCompletion
125:             */
126:            void afterCompletion(int status);
127:
128:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.