If you look at existing CacheLoader implementations such as JDBCCacheLoader, you'll
see that we call cf.commit(tx);.
cf.commit(tx) does not do anything in a managed environment, such as the JBoss Application
server since it's the JBoss JCA layer that will make sure that anything that the
datasource, or database, participates of the transaction correctly. We do the puts in the
prepare() call which is called from beforeCompletion(). The datasource will then interact
with the database and the underlying JDBC connection and do the corresponding
transactional work.
I think you're prepare/commit/rollback phases should be the same as the ones in
JDBCCacheLoader or more precisely, parent AdjListJDBCCacheLoader.
In an unmanaged connection or standalone mode, since the NonManagedConnectionFactory has
direct access to the underlying java.sql.Connection, we do the commit there. I agree that
errors arising here in an unmanaged environment could be an issue but we can't do
anything about it because JBossCache is not a proper XA resource.
One recommendation however would be that if you're using a JDBC-like cache loader, you
should retrieve the connection from the ConnectionFactory we provide and let it do its job
of interacting with the java.sql.Connection accordingly depending on whether it's in a
managed environment or not.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4268436#...
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&a...