Issue Details (XML | Word | Printable)

Key: CORE-3148
Type: Task Task
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Erik Bengtson
Reporter: Erik Bengtson
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
JPOX Core (ARCHIVED)

Decouple Transaction Management from Storage and support for distributed transactions contract (X/Open)

Created: 25/Jan/07 12:21 AM   Updated: 25/Apr/07 08:47 AM   Resolved: 18/Apr/07 10:55 PM
Component/s: None
Affects Version/s: 1.2.0-beta-1
Fix Version/s: 1.2.0-beta-2

Issue Links:
Depend
 


 Description  « Hide
The TransactionSystem instantiates objects to handle transactions via JTA api, JDO api, JCA (bmt or cmt). The TransactionSystem holds the runtime of transactions

Sort Order: Ascending order - Click to sort in descending order
Erik Bengtson added a comment - 25/Jan/07 06:54 AM
needs to delegate to StoreManager since DB4O has specific transaction handler

Andy Jefferson added a comment - 25/Jan/07 07:01 AM
When considering this, also there is CORE-3109

Andy Jefferson added a comment - 27/Jan/07 08:30 AM
Now works with DB4O too.

Andy Jefferson added a comment - 22/Mar/07 11:00 AM
Adding comment from Kenney Westerhof originally raised as a separate issue but then how can it be an issue if it doesnt appear in released code


When configuring a PersistenceManagerFactoryImpl.JDO_CONNECTION_FACTORY_PROPERTY with a DataSource,
I get a ClassCastException in ConnectionFactoryImpl: [Ljava/lang/Object;

This is because of:
{noformat}
                    if( omfContext.getStoreManager() != null )
                    {
! conn = ((RDBMSAdapter)omfContext.getStoreManager().getDatastoreAdapter()).getConnection(new ConnectionProviderPriorityList(), (DataSource[])dsTx, isolation);
                    }
{noformat}

the dsTx is initialized as new Object[1] in the constructor:

{noformat}
        if (config.getConnectionFactory() != null)
        {
            if (!(config.getConnectionFactory() instanceof DataSource) &&
                !(config.getConnectionFactory() instanceof XADataSource))
            {
                throw new UnsupportedConnectionFactoryException(config.getConnectionFactory());
            }
! dsTx = new Object[1];
            dsTx[0] = config.getConnectionFactory();
        }
{noformat}

even though config.getConnectionFactory returns a DataSource.

Andy Jefferson added a comment - 23/Mar/07 07:59 AM
Why is ConnectionManager a separate class? Should be AbstractConnectionFactoryImpl and then we dont need ConnectionManager. ConnectionManager is called by one class (ConnectionFactory) and calls one class (ConnectionFactory) and has very little functionality (a pool) so should be part of a base ConnectionFactoryImpl IMHO. Any reasons why not? It is also currently duplicated under org.jpox.resource for no apparent reason

Erik Bengtson added a comment - 24/Mar/07 10:54 AM
A JCA container has a ConnectionManager, so JPOX does not need to handle the caching of connections.
In standalone mode the ConnectionManager needs to do the pooling to avoid creating multiple connections for the same transaction, and this is the reason of having two implementations.
The ConnectionFactory is there only to create connections, and whenever we add another datastore, we have to implement only it and not a new ConnectionManager.

- ConnectionManager is bound to container (standalone, JCA)
- ConnectionFactory is bound to datastore (rdbms - javax.sql.DataSource, db4o)

Our new transaction handling is pretty much a simplified version of a JCA container.

Andy Jefferson added a comment - 30/Mar/07 07:45 PM
RDBMSManager has dsTx, dsNontx yet ConnectionManager has these too. So we have duplicated data sources (duplicated code block too). What is supposed to be happening here ? Are these RDBMSManager sources going to disappear ? if so, when ? This is a priority since it is stopping any 1.2.0-beta-2 release.

Want to see what is the plan for LocalTransaction, JTATransaction. LocalTransaction should disappear, but what about when in J2SE but user has selected JTA as transactionType ? What happens to org.jpox.transaction.TransactionManager? Does it wrap any found (JTA) TransactionManager? or do we have a new org.jpox.transaction.TransactionManager that is for JTA under J2SE?

What work is needed for JCA?

For beta-2 we dont necessarily need to jave JTATransaction replaced sicne this wasnt publicised in beta-1 anyway, but JCA should work. Timescales for this?

Andy Jefferson added a comment - 30/Mar/07 08:06 PM
DatabaseAdapter.getConnection() should be part of org.jpox.store.rdbms.ConnectionFactoryImpl somewhere since it does nothing more than create Connections. We only need one way of creating JDBC Connections, so that mere mortals like me can understand it.

Andy Jefferson added a comment - 31/Mar/07 10:50 AM
> RDBMSManager has dsTx, dsNontx yet ConnectionManager has these too.
> So we have duplicated data sources (duplicated code block too).
> What is supposed to be happening here ? Are these RDBMSManager sources going to disappear ?

They have now been removed. All datasources should be managed by the ConnectionManager ("rdbms/tx", "rdbms/nontx").

Andy Jefferson added a comment - 31/Mar/07 12:10 PM
> DatabaseAdapter.getConnection() should be part of org.jpox.store.rdbms.ConnectionFactoryImpl
> somewhere since it does nothing more than create Connections.
> We only need one way of creating JDBC Connections, so that mere mortals like me can understand it.

(rdbms.)ConnectionFactoryImpl now includes the necessary code for this, and the DatabaseAdapter methods getConnection()/closeConnection() are now marked as REMOVE. They are currently called by LocalTransaction/JCATransaction

Erik Bengtson added a comment - 18/Apr/07 10:55 PM
should be considered completed by now.