Announcement Announcement Module
Collapse
No announcement yet.
ConnectionSynchronization, DataSourceUtils.java Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • ConnectionSynchronization, DataSourceUtils.java

    Hi,

    I am currently working on Spring.NET (yes, I know this is Spring Java..) and DB4o (OO Database for C#/Java) Integration. As a result, I am reading your source code to understand some aspects of Transaction synchronization, etc, in order to re-implement them.

    Something I am wondering about :
    In DataSourceUtils.java, the getConnection() creates a ConnectionSynchronization instance in order to register it to the TransactionSynchronizationManager.

    However, I can't seem to find what this class is useful for... some comments seem to speak about it being useful in a JTA context.. But what is it exactly for ?
    In a non-JTA context, do we need synchronization ?

    Thanks a lot,
    Sami Dalouche

  • #2
    There is a project (made by yours truly), that has db4o-spring integration and it's available at https://db4o-spring.dev.java.net. TransactionSynchronization is useful (inside or outside JTA) since it offers you the hooks to know before and after the transaction has been completed. This way you can bind or release resources that are depending on these events. Here is an official explanation from the javadocs:
    The transaction manager supports a synchronization mechanism that allows the interested party to be notified before and after the transaction completes. Using the registerSynchronization method, the application server registers a Synchronization object for the transaction currently associated with the target Transaction object

    Comment

    Working...
    X