Java Doc for JmsTransactionManager.java in  » J2EE » spring-framework-2.5 » org » springframework » jms » connection » 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.jms.connection 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.transaction.support.AbstractPlatformTransactionManager
      org.springframework.jms.connection.JmsTransactionManager

All known Subclasses:   org.springframework.jms.connection.JmsTransactionManager102,
JmsTransactionManager
public class JmsTransactionManager extends AbstractPlatformTransactionManager implements ResourceTransactionManager,InitializingBean(Code)
org.springframework.transaction.PlatformTransactionManager implementation for a single JMS javax.jms.ConnectionFactory . Binds a JMS Connection/Session pair from the specified ConnectionFactory to the thread, potentially allowing for one thread-bound Session per ConnectionFactory.

NOTE: This class requires a JMS 1.1+ provider because it builds on the domain-independent API. Use the JmsTransactionManager102 subclass for a JMS 1.0.2 provider, e.g. when running on a J2EE 1.3 server.

This local strategy is an alternative to executing JMS operations within JTA transactions. Its advantage is that it is able to work in any environment, for example a standalone application or a test suite, with any message broker as target. However, this strategy is not able to provide XA transactions, for example in order to share transactions between messaging and database access. A full JTA/XA setup is required for XA transactions, typically using Spring's org.springframework.transaction.jta.JtaTransactionManager as strategy.

Application code is required to retrieve the transactional JMS Session via ConnectionFactoryUtils.getTransactionalSession instead of a standard J2EE-style ConnectionFactory.createConnection call with subsequent Session creation. Spring's org.springframework.jms.core.JmsTemplate will autodetect a thread-bound Session and automatically participate in it.

Alternatively, you can allow application code to work with the standard J2EE-style lookup pattern on a ConnectionFactory, for example for legacy code that is not aware of Spring at all. In that case, define a TransactionAwareConnectionFactoryProxy for your target ConnectionFactory, which will automatically participate in Spring-managed transactions.

This transaction strategy will typically be used in combination with SingleConnectionFactory , which uses a single JMS Connection for all JMS access in order to avoid the overhead of repeated Connection creation, typically in a standalone application. Each transaction will then share the same JMS Connection, while still using its own individual JMS Session.

Transaction synchronization is turned off by default, as this manager might be used alongside a datastore-based Spring transaction manager such as the JDBC org.springframework.jdbc.datasource.DataSourceTransactionManager , which has stronger needs for synchronization.
author:
   Juergen Hoeller
since:
   1.1
See Also:   ConnectionFactoryUtils.getTransactionalSession
See Also:   TransactionAwareConnectionFactoryProxy
See Also:   org.springframework.jms.core.JmsTemplate




Constructor Summary
public  JmsTransactionManager()
     Create a new JmsTransactionManager for bean-style usage.
public  JmsTransactionManager(ConnectionFactory connectionFactory)
     Create a new JmsTransactionManager, given a ConnectionFactory.

Method Summary
public  voidafterPropertiesSet()
     Make sure the ConnectionFactory has been set.
protected  ConnectioncreateConnection()
     Create a JMS Connection via this template's ConnectionFactory.
protected  SessioncreateSession(Connection con)
     Create a JMS Session for the given Connection.
protected  voiddoBegin(Object transaction, TransactionDefinition definition)
    
protected  voiddoCleanupAfterCompletion(Object transaction)
    
protected  voiddoCommit(DefaultTransactionStatus status)
    
protected  ObjectdoGetTransaction()
    
protected  voiddoResume(Object transaction, Object suspendedResources)
    
protected  voiddoRollback(DefaultTransactionStatus status)
    
protected  voiddoSetRollbackOnly(DefaultTransactionStatus status)
    
protected  ObjectdoSuspend(Object transaction)
    
public  ConnectionFactorygetConnectionFactory()
     Return the JMS ConnectionFactory that this instance should manage transactions for.
public  ObjectgetResourceFactory()
    
protected  booleanisExistingTransaction(Object transaction)
    
public  voidsetConnectionFactory(ConnectionFactory cf)
     Set the JMS ConnectionFactory that this instance should manage transactions for.


Constructor Detail
JmsTransactionManager
public JmsTransactionManager()(Code)
Create a new JmsTransactionManager for bean-style usage.

Note: The ConnectionFactory has to be set before using the instance. This constructor can be used to prepare a JmsTemplate via a BeanFactory, typically setting the ConnectionFactory via setConnectionFactory.

Turns off transaction synchronization by default, as this manager might be used alongside a datastore-based Spring transaction manager like DataSourceTransactionManager, which has stronger needs for synchronization. Only one manager is allowed to drive synchronization at any point of time.
See Also:   JmsTransactionManager.setConnectionFactory
See Also:   JmsTransactionManager.setTransactionSynchronization




JmsTransactionManager
public JmsTransactionManager(ConnectionFactory connectionFactory)(Code)
Create a new JmsTransactionManager, given a ConnectionFactory.
Parameters:
  connectionFactory - the ConnectionFactory to obtain connections from




Method Detail
afterPropertiesSet
public void afterPropertiesSet()(Code)
Make sure the ConnectionFactory has been set.



createConnection
protected Connection createConnection() throws JMSException(Code)
Create a JMS Connection via this template's ConnectionFactory.

This implementation uses JMS 1.1 API. the new JMS Connection
throws:
  javax.jms.JMSException - if thrown by JMS API methods




createSession
protected Session createSession(Connection con) throws JMSException(Code)
Create a JMS Session for the given Connection.

This implementation uses JMS 1.1 API.
Parameters:
  con - the JMS Connection to create a Session for the new JMS Session
throws:
  javax.jms.JMSException - if thrown by JMS API methods




doBegin
protected void doBegin(Object transaction, TransactionDefinition definition)(Code)



doCleanupAfterCompletion
protected void doCleanupAfterCompletion(Object transaction)(Code)



doCommit
protected void doCommit(DefaultTransactionStatus status)(Code)



doGetTransaction
protected Object doGetTransaction()(Code)



doResume
protected void doResume(Object transaction, Object suspendedResources)(Code)



doRollback
protected void doRollback(DefaultTransactionStatus status)(Code)



doSetRollbackOnly
protected void doSetRollbackOnly(DefaultTransactionStatus status)(Code)



doSuspend
protected Object doSuspend(Object transaction)(Code)



getConnectionFactory
public ConnectionFactory getConnectionFactory()(Code)
Return the JMS ConnectionFactory that this instance should manage transactions for.



getResourceFactory
public Object getResourceFactory()(Code)



isExistingTransaction
protected boolean isExistingTransaction(Object transaction)(Code)



setConnectionFactory
public void setConnectionFactory(ConnectionFactory cf)(Code)
Set the JMS ConnectionFactory that this instance should manage transactions for.



Fields inherited from org.springframework.transaction.support.AbstractPlatformTransactionManager
final public static int SYNCHRONIZATION_ALWAYS(Code)(Java Doc)
final public static int SYNCHRONIZATION_NEVER(Code)(Java Doc)
final public static int SYNCHRONIZATION_ON_ACTUAL_TRANSACTION(Code)(Java Doc)
protected transient Log logger(Code)(Java Doc)

Methods inherited from org.springframework.transaction.support.AbstractPlatformTransactionManager
final public void commit(TransactionStatus status) throws TransactionException(Code)(Java Doc)
protected int determineTimeout(TransactionDefinition definition)(Code)(Java Doc)
abstract protected void doBegin(Object transaction, TransactionDefinition definition) throws TransactionException(Code)(Java Doc)
protected void doCleanupAfterCompletion(Object transaction)(Code)(Java Doc)
abstract protected void doCommit(DefaultTransactionStatus status) throws TransactionException(Code)(Java Doc)
abstract protected Object doGetTransaction() throws TransactionException(Code)(Java Doc)
protected void doResume(Object transaction, Object suspendedResources) throws TransactionException(Code)(Java Doc)
abstract protected void doRollback(DefaultTransactionStatus status) throws TransactionException(Code)(Java Doc)
protected void doSetRollbackOnly(DefaultTransactionStatus status) throws TransactionException(Code)(Java Doc)
protected Object doSuspend(Object transaction) throws TransactionException(Code)(Java Doc)
final public int getDefaultTimeout()(Code)(Java Doc)
final public TransactionStatus getTransaction(TransactionDefinition definition) throws TransactionException(Code)(Java Doc)
final public int getTransactionSynchronization()(Code)(Java Doc)
final protected void invokeAfterCompletion(List synchronizations, int completionStatus)(Code)(Java Doc)
protected boolean isExistingTransaction(Object transaction) throws TransactionException(Code)(Java Doc)
final public boolean isFailEarlyOnGlobalRollbackOnly()(Code)(Java Doc)
final public boolean isGlobalRollbackOnParticipationFailure()(Code)(Java Doc)
final public boolean isNestedTransactionAllowed()(Code)(Java Doc)
final public boolean isRollbackOnCommitFailure()(Code)(Java Doc)
protected DefaultTransactionStatus newTransactionStatus(TransactionDefinition definition, Object transaction, boolean newTransaction, boolean newSynchronization, boolean debug, Object suspendedResources)(Code)(Java Doc)
protected void registerAfterCompletionWithExistingTransaction(Object transaction, List synchronizations) throws TransactionException(Code)(Java Doc)
final protected void resume(Object transaction, SuspendedResourcesHolder resourcesHolder) throws TransactionException(Code)(Java Doc)
final public void rollback(TransactionStatus status) throws TransactionException(Code)(Java Doc)
final public void setDefaultTimeout(int defaultTimeout)(Code)(Java Doc)
final public void setFailEarlyOnGlobalRollbackOnly(boolean failEarlyOnGlobalRollbackOnly)(Code)(Java Doc)
final public void setGlobalRollbackOnParticipationFailure(boolean globalRollbackOnParticipationFailure)(Code)(Java Doc)
final public void setNestedTransactionAllowed(boolean nestedTransactionAllowed)(Code)(Java Doc)
final public void setRollbackOnCommitFailure(boolean rollbackOnCommitFailure)(Code)(Java Doc)
final public void setTransactionSynchronization(int transactionSynchronization)(Code)(Java Doc)
final public void setTransactionSynchronizationName(String constantName)(Code)(Java Doc)
protected boolean shouldCommitOnGlobalRollbackOnly()(Code)(Java Doc)
final protected SuspendedResourcesHolder suspend(Object transaction) throws TransactionException(Code)(Java Doc)
final protected void triggerBeforeCommit(DefaultTransactionStatus status)(Code)(Java Doc)
final protected void triggerBeforeCompletion(DefaultTransactionStatus status)(Code)(Java Doc)
protected boolean useSavepointForNestedTransaction()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.