Tuesday, June 12, 2012

Difference between XA resource register && Synchronization Listener && Last resource Gammit


Transaction synchronization

Transaction synchronization allows the application server to be notified before and after the transaction completes. For each transaction started, the application server may optionally register a Synchronization call back object to be invoked by the transaction manager:

The beforeCompletion method is called prior to the start of the two-phase transaction complete process. This call is executed in the same transaction context of the caller who initiates the TransactionManager.commit or the call is executed with no transaction context if Transaction.commit is used.

The afterCompletion method is called after the transaction has completed. The status of the transaction is supplied in the parameter. This method is executed without a transaction context.

Logs With Synchronization


(One mysql Xa resource and rest infinispan caches register as synchronization)

 11: 2012-06-12 10:58:30,604 [serviceTaskExecutor-26] WARN  atomikos.println:107  - Attempt to create a transaction with a timeout that exceeds com.atomikos.icatch.max_timeout - truncating to: 300000
 12: 2012-06-12 10:58:30,605 [serviceTaskExecutor-26] INFO  atomikos.println:110  - createCompositeTransaction ( 500000 ): created new ROOT transaction with id tm_tspex-app-container_10428400061
 14: 2012-06-12 10:58:30,606 [serviceTaskExecutor-26] INFO  atomikos.println:110  - addParticipant ( XAResourceTransaction: 746D5F74737065782D6170702D636F6E7461696E65725F3130343238343030303631:746D5F74737065782D6170702D636F6E7461696E65725F3132393934 ) for transaction tm_tspex-app-container_10428400061
 15: 2012-06-12 10:58:30,607 [serviceTaskExecutor-26] INFO  atomikos.println:110  - XAResource.start ( 746D5F74737065782D6170702D636F6E7461696E65725F3130343238343030303631:746D5F74737065782D6170702D636F6E7461696E65725F3132393934 , XAResource.TMNOFLAGS ) on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@28333b1e
 16: 2012-06-12 10:58:30,607 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@9325ee79 ) for transaction tm_tspex-app-container_10428400061
 20: 2012-06-12 10:58:30,641 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.icatch.jta.Sync2Sync@60401ebd ) for transaction tm_tspex-app-container_10428400061
 21: 2012-06-12 10:58:30,641 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.icatch.jta.Sync2Sync@4cd63ee8 ) for transaction tm_tspex-app-container_10428400061
 22: 2012-06-12 10:58:30,642 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.icatch.jta.Sync2Sync@6335b062 ) for transaction tm_tspex-app-container_10428400061
 24: 2012-06-12 10:58:30,643 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.icatch.jta.Sync2Sync@61de2f59 ) for transaction tm_tspex-app-container_10428400061
 25: 2012-06-12 10:58:30,643 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.icatch.jta.Sync2Sync@3fb801c4 ) for transaction tm_tspex-app-container_10428400061
 26: 2012-06-12 10:58:30,644 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@9325ee79 ) for transaction tm_tspex-app-container_10428400061
 29: 2012-06-12 10:58:30,645 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@9325ee79 ) for transaction tm_tspex-app-container_10428400061
 33: 2012-06-12 10:58:30,669 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.icatch.jta.Sync2Sync@8658edb ) for transaction tm_tspex-app-container_10428400061
 34: 2012-06-12 10:58:30,670 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@9325ee79 ) for transaction tm_tspex-app-container_10428400061
 35: 2012-06-12 10:58:30,736 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@9325ee79 ) for transaction tm_tspex-app-container_10428400061
 41: 2012-06-12 10:58:30,780 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.icatch.jta.Sync2Sync@443bfd3 ) for transaction tm_tspex-app-container_10428400061
 44: 2012-06-12 10:58:30,781 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.icatch.jta.Sync2Sync@5e2fe41a ) for transaction tm_tspex-app-container_10428400061
 45: 2012-06-12 10:58:30,782 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.icatch.jta.Sync2Sync@199ae4c6 ) for transaction tm_tspex-app-container_10428400061
 55: 2012-06-12 10:58:30,784 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@9325ee79 ) for transaction tm_tspex-app-container_10428400061
 57: 2012-06-12 10:58:30,784 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@9325ee79 ) for transaction tm_tspex-app-container_10428400061
 59: 2012-06-12 10:58:30,785 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@9325ee79 ) for transaction tm_tspex-app-container_10428400061
 60: 2012-06-12 10:58:30,837 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@9325ee79 ) for transaction tm_tspex-app-container_10428400061
 62: 2012-06-12 10:58:30,838 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@9325ee79 ) for transaction tm_tspex-app-container_10428400061
 64: 2012-06-12 10:58:30,840 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.icatch.jta.Sync2Sync@3f5018a0 ) for transaction tm_tspex-app-container_10428400061
 70: 2012-06-12 10:58:30,843 [serviceTaskExecutor-26] INFO  atomikos.println:110  - XAResource.end ( 746D5F74737065782D6170702D636F6E7461696E65725F3130343238343030303631:746D5F74737065782D6170702D636F6E7461696E65725F3132393934 , XAResource.TMSUCCESS ) on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@28333b1e
 72: 2012-06-12 10:58:30,844 [serviceTaskExecutor-26] INFO  atomikos.println:110  - commit() done (by application) of transaction tm_tspex-app-container_10428400061
 73: 2012-06-12 10:58:30,889 [Atomikos:488] INFO  atomikos.println:110  - XAResource.prepare ( 746D5F74737065782D6170702D636F6E7461696E65725F3130343238343030303631:746D5F74737065782D6170702D636F6E7461696E65725F3132393934 ) returning OK on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@28333b1e
 74: 2012-06-12 10:58:30,890 [Atomikos:488] INFO  atomikos.println:110  - XAResource.commit ( 746D5F74737065782D6170702D636F6E7461696E65725F3130343238343030303631:746D5F74737065782D6170702D636F6E7461696E65725F3132393934 , false ) on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@28333b1e
 75: 2012-06-12 10:58:30,913 [serviceTaskExecutor-26] INFO  atomikos.println:110  - afterCompletion ( STATUS_COMMITTED ) called  on Synchronization: SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10428400061, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.synchronization.SyncLocalTransaction@f19} org.infinispan.transaction.synchronization.SynchronizationAdapter@f38
 76: 2012-06-12 10:58:30,913 [serviceTaskExecutor-26] INFO  atomikos.println:110  - afterCompletion ( STATUS_COMMITTED ) called  on Synchronization: SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10428400061, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.synchronization.SyncLocalTransaction@f18} org.infinispan.transaction.synchronization.SynchronizationAdapter@f37
 77: 2012-06-12 10:58:30,914 [serviceTaskExecutor-26] INFO  atomikos.println:110  - afterCompletion ( STATUS_COMMITTED ) called  on Synchronization: SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10428400061, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.synchronization.SyncLocalTransaction@f16} org.infinispan.transaction.synchronization.SynchronizationAdapter@f35
 80: 2012-06-12 10:58:30,916 [serviceTaskExecutor-26] INFO  atomikos.println:110  - afterCompletion ( STATUS_COMMITTED ) called  on Synchronization: SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=[TSSEDEV5-34849], isMarkedForRollback=false, transaction=tm_tspex-app-container_10428400061, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.synchronization.SyncLocalTransaction@f1a} org.infinispan.transaction.synchronization.SynchronizationAdapter@f39
 81: 2012-06-12 10:58:30,916 [serviceTaskExecutor-26] INFO  atomikos.println:110  - afterCompletion ( STATUS_COMMITTED ) called  on Synchronization: SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10428400061, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.synchronization.SyncLocalTransaction@f17} org.infinispan.transaction.synchronization.SynchronizationAdapter@f36
 82: 2012-06-12 10:58:30,917 [serviceTaskExecutor-26] INFO  atomikos.println:110  - afterCompletion ( STATUS_COMMITTED ) called  on Synchronization: SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10428400061, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.synchronization.SyncLocalTransaction@f15} org.infinispan.transaction.synchronization.SynchronizationAdapter@f34
 83: 2012-06-12 10:58:30,917 [serviceTaskExecutor-26] INFO  atomikos.println:110  - afterCompletion ( STATUS_COMMITTED ) called  on Synchronization: SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10428400061, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.synchronization.SyncLocalTransaction@f14} org.infinispan.transaction.synchronization.SynchronizationAdapter@f33
 84: 2012-06-12 10:58:30,917 [serviceTaskExecutor-26] INFO  atomikos.println:110  - afterCompletion ( STATUS_COMMITTED ) called  on Synchronization: SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10428400061, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.synchronization.SyncLocalTransaction@f13} org.infinispan.transaction.synchronization.SynchronizationAdapter@f32
 85: 2012-06-12 10:58:30,918 [serviceTaskExecutor-26] INFO  atomikos.println:110  - afterCompletion ( STATUS_COMMITTED ) called  on Synchronization: SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10428400061, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.synchronization.SyncLocalTransaction@f11} org.infinispan.transaction.synchronization.SynchronizationAdapter@f30
 86: 2012-06-12 10:58:30,918 [serviceTaskExecutor-26] INFO  atomikos.println:110  - afterCompletion ( STATUS_COMMITTED ) called  on Synchronization: SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10428400061, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.synchronization.SyncLocalTransaction@f12} org.infinispan.transaction.synchronization.SynchronizationAdapter@f31
105: 2012-06-12 10:58:30,924 [serviceTaskExecutor-26] WARN  atomikos.println:107  - Attempt to create a transaction with a timeout that exceeds com.atomikos.icatch.max_timeout - truncating to: 300000
106: 2012-06-12 10:58:30,925 [serviceTaskExecutor-26] INFO  atomikos.println:110  - createCompositeTransaction ( 500000 ): created new ROOT transaction with id tm_tspex-app-container_10428500061
107: 2012-06-12 10:58:30,925 [serviceTaskExecutor-26] INFO  atomikos.println:110  - addParticipant ( XAResourceTransaction: 746D5F74737065782D6170702D636F6E7461696E65725F3130343238353030303631:746D5F74737065782D6170702D636F6E7461696E65725F3132393935 ) for transaction tm_tspex-app-container_10428500061
108: 2012-06-12 10:58:30,926 [serviceTaskExecutor-26] INFO  atomikos.println:110  - XAResource.start ( 746D5F74737065782D6170702D636F6E7461696E65725F3130343238353030303631:746D5F74737065782D6170702D636F6E7461696E65725F3132393935 , XAResource.TMNOFLAGS ) on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@28333b1e
109: 2012-06-12 10:58:30,926 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@94dac718 ) for transaction tm_tspex-app-container_10428500061
110: 2012-06-12 10:58:30,927 [serviceTaskExecutor-26] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@94dac718 ) for transaction tm_tspex-app-container_10428500061
111: 2012-06-12 10:58:30,928 [serviceTaskExecutor-26] INFO  atomikos.println:110  - XAResource.end ( 746D5F74737065782D6170702D636F6E7461696E65725F3130343238353030303631:746D5F74737065782D6170702D636F6E7461696E65725F3132393935 , XAResource.TMSUCCESS ) on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@28333b1e
113: 2012-06-12 10:58:30,929 [serviceTaskExecutor-26] INFO  atomikos.println:110  - commit() done (by application) of transaction tm_tspex-app-container_10428500061
116: 2012-06-12 10:58:30,930 [MatchingEngine-8] WARN  atomikos.println:107  - Attempt to create a transaction with a timeout that exceeds com.atomikos.icatch.max_timeout - truncating to: 300000
117: 2012-06-12 10:58:30,930 [MatchingEngine-8] INFO  atomikos.println:110  - createCompositeTransaction ( 500000 ): created new ROOT transaction with id tm_tspex-app-container_10428600061
118: 2012-06-12 10:58:30,931 [MatchingEngine-8] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.icatch.jta.Sync2Sync@54f3b495 ) for transaction tm_tspex-app-container_10428600061
119: 2012-06-12 10:58:30,931 [MatchingEngine-8] INFO  atomikos.println:110  - commit() done (by application) of transaction tm_tspex-app-container_10428600061
120: 2012-06-12 10:58:30,932 [MatchingEngine-8] INFO  atomikos.println:110  - afterCompletion ( STATUS_COMMITTED ) called  on Synchronization: SynchronizationAdapter{localTransaction=LocalTransaction{remoteLockedNodes=[TSSEDEV5-34849], isMarkedForRollback=false, transaction=tm_tspex-app-container_10428600061, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.synchronization.SyncLocalTransaction@f1b} org.infinispan.transaction.synchronization.SynchronizationAdapter@f3a
123: 2012-06-12 10:58:30,947 [Atomikos:488] INFO  atomikos.println:110  - XAResource.prepare ( 746D5F74737065782D6170702D636F6E7461696E65725F3130343238353030303631:746D5F74737065782D6170702D636F6E7461696E65725F3132393935 ) returning OK on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@28333b1e
124: 2012-06-12 10:58:30,948 [Atomikos:488] INFO  atomikos.println:110  - XAResource.commit ( 746D5F74737065782D6170702D636F6E7461696E65725F3130343238353030303631:746D5F74737065782D6170702D636F6E7461696E65725F3132393935 , false ) on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@28333b1e

With XA Resource
(Mysql and Infinispan caches as XA resources)

With XA, each resource get added to a list when it is used, and when the transaction is committed separate prepare calls are sent to each of the resources. Once the prepare calls are successful, commit calls are sent to each of the resources to commit the transactions.



 10: 2012-06-12 11:13:39,506 [serviceTaskExecutor-5] INFO  atomikos.println:110  - createCompositeTransaction ( 300000 ): created new ROOT transaction with id tm_tspex-app-container_10173700062
 12: 2012-06-12 11:13:39,508 [serviceTaskExecutor-5] INFO  atomikos.println:110  - addParticipant ( XAResourceTransaction: 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:746D5F74737065782D6170702D636F6E7461696E65725F3131373436 ) for transaction tm_tspex-app-container_10173700062
 13: 2012-06-12 11:13:39,509 [serviceTaskExecutor-5] INFO  atomikos.println:110  - XAResource.start ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:746D5F74737065782D6170702D636F6E7461696E65725F3131373436 , XAResource.TMNOFLAGS ) on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@4e49879a
 14: 2012-06-12 11:13:39,510 [serviceTaskExecutor-5] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@da5de36a ) for transaction tm_tspex-app-container_10173700062
 18: 2012-06-12 11:13:39,513 [serviceTaskExecutor-5] INFO  atomikos.println:110  - addParticipant ( XAResourceTransaction: 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373437 ) for transaction tm_tspex-app-container_10173700062
 19: 2012-06-12 11:13:39,514 [serviceTaskExecutor-5] INFO  atomikos.println:110  - XAResource.start ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373437 , XAResource.TMNOFLAGS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=null} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@4ff}
 20: 2012-06-12 11:13:39,515 [serviceTaskExecutor-5] INFO  atomikos.println:110  - addParticipant ( XAResourceTransaction: 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373438 ) for transaction tm_tspex-app-container_10173700062
 21: 2012-06-12 11:13:39,516 [serviceTaskExecutor-5] INFO  atomikos.println:110  - XAResource.start ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373438 , XAResource.TMNOFLAGS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=null} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@500}
 22: 2012-06-12 11:13:39,517 [serviceTaskExecutor-5] INFO  atomikos.println:110  - addParticipant ( XAResourceTransaction: 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373439 ) for transaction tm_tspex-app-container_10173700062
 23: 2012-06-12 11:13:39,518 [serviceTaskExecutor-5] INFO  atomikos.println:110  - XAResource.start ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373439 , XAResource.TMNOFLAGS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=null} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@501}
 24: 2012-06-12 11:13:39,519 [serviceTaskExecutor-5] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@da5de36a ) for transaction tm_tspex-app-container_10173700062
 27: 2012-06-12 11:13:39,522 [serviceTaskExecutor-5] INFO  atomikos.println:110  - addParticipant ( XAResourceTransaction: 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373530 ) for transaction tm_tspex-app-container_10173700062
 28: 2012-06-12 11:13:39,523 [serviceTaskExecutor-5] INFO  atomikos.println:110  - XAResource.start ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373530 , XAResource.TMNOFLAGS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=null} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@502}
 29: 2012-06-12 11:13:39,543 [serviceTaskExecutor-5] INFO  atomikos.println:110  - addParticipant ( XAResourceTransaction: 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373531 ) for transaction tm_tspex-app-container_10173700062
 30: 2012-06-12 11:13:39,544 [serviceTaskExecutor-5] INFO  atomikos.println:110  - XAResource.start ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373531 , XAResource.TMNOFLAGS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=null} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@503}
 31: 2012-06-12 11:13:39,544 [serviceTaskExecutor-5] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@da5de36a ) for transaction tm_tspex-app-container_10173700062
 34: 2012-06-12 11:13:39,546 [serviceTaskExecutor-5] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@da5de36a ) for transaction tm_tspex-app-container_10173700062
 38: 2012-06-12 11:13:39,548 [serviceTaskExecutor-5] INFO  atomikos.println:110  - addParticipant ( XAResourceTransaction: 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373532 ) for transaction tm_tspex-app-container_10173700062
 39: 2012-06-12 11:13:39,548 [serviceTaskExecutor-5] INFO  atomikos.println:110  - XAResource.start ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373532 , XAResource.TMNOFLAGS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=null} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@504}
 40: 2012-06-12 11:13:39,549 [serviceTaskExecutor-5] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@da5de36a ) for transaction tm_tspex-app-container_10173700062
 41: 2012-06-12 11:13:39,560 [serviceTaskExecutor-5] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@da5de36a ) for transaction tm_tspex-app-container_10173700062
 52: 2012-06-12 11:13:39,715 [serviceTaskExecutor-5] INFO  atomikos.println:110  - addParticipant ( XAResourceTransaction: 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373533 ) for transaction tm_tspex-app-container_10173700062
 53: 2012-06-12 11:13:39,715 [serviceTaskExecutor-5] INFO  atomikos.println:110  - XAResource.start ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373533 , XAResource.TMNOFLAGS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=null} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@505}
 56: 2012-06-12 11:13:39,721 [serviceTaskExecutor-5] INFO  atomikos.println:110  - addParticipant ( XAResourceTransaction: 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373534 ) for transaction tm_tspex-app-container_10173700062
 57: 2012-06-12 11:13:39,722 [serviceTaskExecutor-5] INFO  atomikos.println:110  - XAResource.start ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373534 , XAResource.TMNOFLAGS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=null} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@506}
 58: 2012-06-12 11:13:39,722 [serviceTaskExecutor-5] INFO  atomikos.println:110  - addParticipant ( XAResourceTransaction: 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:746D5F74737065782D6170702D636F6E7461696E65725F3131373535 ) for transaction tm_tspex-app-container_10173700062
 59: 2012-06-12 11:13:39,722 [serviceTaskExecutor-5] INFO  atomikos.println:110  - XAResource.start ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:746D5F74737065782D6170702D636F6E7461696E65725F3131373535 , XAResource.TMNOFLAGS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=null} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@507}
 68: 2012-06-12 11:13:39,725 [serviceTaskExecutor-5] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@da5de36a ) for transaction tm_tspex-app-container_10173700062
 70: 2012-06-12 11:13:39,726 [serviceTaskExecutor-5] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@da5de36a ) for transaction tm_tspex-app-container_10173700062
 71: 2012-06-12 11:13:39,727 [serviceTaskExecutor-5] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@da5de36a ) for transaction tm_tspex-app-container_10173700062
 72: 2012-06-12 11:13:39,728 [serviceTaskExecutor-5] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@da5de36a ) for transaction tm_tspex-app-container_10173700062
 74: 2012-06-12 11:13:39,729 [serviceTaskExecutor-5] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@da5de36a ) for transaction tm_tspex-app-container_10173700062
 76: 2012-06-12 11:13:39,730 [serviceTaskExecutor-5] INFO  atomikos.println:110  - addParticipant ( XAResourceTransaction: 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373536 ) for transaction tm_tspex-app-container_10173700062
 77: 2012-06-12 11:13:39,730 [serviceTaskExecutor-5] INFO  atomikos.println:110  - XAResource.start ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373536 , XAResource.TMNOFLAGS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=null} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@508}
 85: 2012-06-12 11:13:39,733 [serviceTaskExecutor-5] INFO  atomikos.println:110  - XAResource.end ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:746D5F74737065782D6170702D636F6E7461696E65725F3131373436 , XAResource.TMSUCCESS ) on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@4e49879a
 86: 2012-06-12 11:13:39,733 [serviceTaskExecutor-5] INFO  atomikos.println:110  - commit() done (by application) of transaction tm_tspex-app-container_10173700062
 87: 2012-06-12 11:13:39,733 [Atomikos:6] INFO  atomikos.println:110  - XAResource.end ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373437 , XAResource.TMSUCCESS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1747} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@4ff}
 88: 2012-06-12 11:13:39,734 [Atomikos:10] INFO  atomikos.println:110  - XAResource.end ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373534 , XAResource.TMSUCCESS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1754} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@506}
 89: 2012-06-12 11:13:39,737 [Atomikos:10] INFO  atomikos.println:110  - XAResource.prepare ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373534 ) returning OK on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1754} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@506}
 90: 2012-06-12 11:13:39,734 [Atomikos:7] INFO  atomikos.println:110  - XAResource.end ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373532 , XAResource.TMSUCCESS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1752} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@504}
 91: 2012-06-12 11:13:39,737 [Atomikos:12] INFO  atomikos.println:110  - XAResource.end ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373536 , XAResource.TMSUCCESS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1756} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@508}
 92: 2012-06-12 11:13:39,739 [Atomikos:12] INFO  atomikos.println:110  - XAResource.prepare ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373536 ) returning OK on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1756} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@508}
 93: 2012-06-12 11:13:39,734 [Atomikos:3] INFO  atomikos.println:110  - XAResource.end ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373438 , XAResource.TMSUCCESS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1748} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@500}
 94: 2012-06-12 11:13:39,739 [Atomikos:3] INFO  atomikos.println:110  - XAResource.prepare ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373438 ) returning OK on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1748} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@500}
 95: 2012-06-12 11:13:39,734 [Atomikos:5] INFO  atomikos.println:110  - XAResource.end ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373531 , XAResource.TMSUCCESS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1751} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@503}
 96: 2012-06-12 11:13:39,740 [Atomikos:5] INFO  atomikos.println:110  - XAResource.prepare ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373531 ) returning OK on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1751} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@503}
 97: 2012-06-12 11:13:39,734 [Atomikos:4] INFO  atomikos.println:110  - XAResource.end ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373439 , XAResource.TMSUCCESS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1749} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@501}
 98: 2012-06-12 11:13:39,740 [Atomikos:4] INFO  atomikos.println:110  - XAResource.prepare ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373439 ) returning OK on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1749} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@501}
 99: 2012-06-12 11:13:39,734 [Atomikos:1] INFO  atomikos.println:110  - XAResource.end ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373530 , XAResource.TMSUCCESS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1750} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@502}
100: 2012-06-12 11:13:39,737 [Atomikos:7] INFO  atomikos.println:110  - XAResource.prepare ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373532 ) returning OK on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1752} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@504}
101: 2012-06-12 11:13:39,737 [Atomikos:9] INFO  atomikos.println:110  - XAResource.end ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373533 , XAResource.TMSUCCESS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1753} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@505}
102: 2012-06-12 11:13:39,734 [Atomikos:6] INFO  atomikos.println:110  - XAResource.prepare ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373437 ) returning OK on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1747} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@4ff}
103: 2012-06-12 11:13:39,734 [Atomikos:11] INFO  atomikos.println:110  - XAResource.end ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:746D5F74737065782D6170702D636F6E7461696E65725F3131373535 , XAResource.TMSUCCESS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062tm_tspex-app-container_11755} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@507}
104: 2012-06-12 11:13:39,743 [Atomikos:11] INFO  atomikos.println:110  - XAResource.prepare ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:746D5F74737065782D6170702D636F6E7461696E65725F3131373535 ) returning OK on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062tm_tspex-app-container_11755} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@507}
105: 2012-06-12 11:13:39,742 [Atomikos:9] INFO  atomikos.println:110  - XAResource.prepare ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373533 ) returning OK on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1753} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@505}
106: 2012-06-12 11:13:39,740 [Atomikos:1] INFO  atomikos.println:110  - XAResource.prepare ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373530 ) returning OK on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1750} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@502}
107: 2012-06-12 11:13:39,767 [Atomikos:8] INFO  atomikos.println:110  - XAResource.prepare ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:746D5F74737065782D6170702D636F6E7461696E65725F3131373436 ) returning OK on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@4e49879a
108: 2012-06-12 11:13:39,767 [Atomikos:8] INFO  atomikos.println:110  - XAResource.commit ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:746D5F74737065782D6170702D636F6E7461696E65725F3131373436 , false ) on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@4e49879a
109: 2012-06-12 11:13:39,767 [Atomikos:3] INFO  atomikos.println:110  - XAResource.commit ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373534 , false ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1754} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@506}
110: 2012-06-12 11:13:39,767 [Atomikos:5] INFO  atomikos.println:110  - XAResource.commit ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373533 , false ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1753} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@505}
111: 2012-06-12 11:13:39,767 [Atomikos:4] INFO  atomikos.println:110  - XAResource.commit ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373532 , false ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1752} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@504}
112: 2012-06-12 11:13:39,767 [Atomikos:11] INFO  atomikos.println:110  - XAResource.commit ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373439 , false ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1749} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@501}
113: 2012-06-12 11:13:39,767 [Atomikos:7] INFO  atomikos.println:110  - XAResource.commit ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373531 , false ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1751} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@503}
114: 2012-06-12 11:13:39,767 [Atomikos:9] INFO  atomikos.println:110  - XAResource.commit ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373438 , false ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1748} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@500}
115: 2012-06-12 11:13:39,767 [Atomikos:1] INFO  atomikos.println:110  - XAResource.commit ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373437 , false ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1747} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@4ff}
117: 2012-06-12 11:13:39,767 [Atomikos:12] INFO  atomikos.println:110  - XAResource.commit ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:746D5F74737065782D6170702D636F6E7461696E65725F3131373535 , false ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062tm_tspex-app-container_11755} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@507}
118: 2012-06-12 11:13:39,767 [Atomikos:6] INFO  atomikos.println:110  - XAResource.commit ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373530 , false ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1750} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@502}
119: 2012-06-12 11:13:39,767 [Atomikos:10] INFO  atomikos.println:110  - XAResource.commit ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733373030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373536 , false ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173700062TransactionXaAdapter{localTransaction=LocalXa1756} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173700062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@508}
139: 2012-06-12 11:13:39,811 [MatchingEngine-8] INFO  atomikos.println:110  - createCompositeTransaction ( 300000 ): created new ROOT transaction with id tm_tspex-app-container_10173800062
140: 2012-06-12 11:13:39,811 [MatchingEngine-8] INFO  atomikos.println:110  - addParticipant ( XAResourceTransaction: 746D5F74737065782D6170702D636F6E7461696E65725F3130313733383030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373537 ) for transaction tm_tspex-app-container_10173800062
141: 2012-06-12 11:13:39,811 [MatchingEngine-8] INFO  atomikos.println:110  - XAResource.start ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733383030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373537 , XAResource.TMNOFLAGS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=null} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173800062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@509}
142: 2012-06-12 11:13:39,812 [MatchingEngine-8] INFO  atomikos.println:110  - commit() done (by application) of transaction tm_tspex-app-container_10173800062
143: 2012-06-12 11:13:39,812 [Atomikos:8] INFO  atomikos.println:110  - XAResource.end ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733383030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373537 , XAResource.TMSUCCESS ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173800062TransactionXaAdapter{localTransaction=LocalXa1757} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173800062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@509}
144: 2012-06-12 11:13:39,812 [Atomikos:8] INFO  atomikos.println:110  - XAResource.commit ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733383030303632:5472616E73616374696F6E5861416461707465727B6C6F63616C5472616E73616374696F6E3D4C6F63616C586131373537 , true ) on resource TransactionXaAdapter{localTransaction=LocalXa represented by XAResource instance TransactionXaAdapter{localTransaction=LocalXaTransaction{xid=tm_tspex-app-container_10173800062TransactionXaAdapter{localTransaction=LocalXa1757} LocalTransaction{remoteLockedNodes=null, isMarkedForRollback=false, transaction=tm_tspex-app-container_10173800062, lockedKeys=null, backupKeyLocks=null, viewId=0} org.infinispan.transaction.xa.LocalXaTransaction@509}
156: 2012-06-12 11:13:39,820 [serviceTaskExecutor-5] INFO  atomikos.println:110  - createCompositeTransaction ( 300000 ): created new ROOT transaction with id tm_tspex-app-container_10173900062
157: 2012-06-12 11:13:39,821 [serviceTaskExecutor-5] INFO  atomikos.println:110  - addParticipant ( XAResourceTransaction: 746D5F74737065782D6170702D636F6E7461696E65725F3130313733393030303632:746D5F74737065782D6170702D636F6E7461696E65725F3131373538 ) for transaction tm_tspex-app-container_10173900062
158: 2012-06-12 11:13:39,822 [serviceTaskExecutor-5] INFO  atomikos.println:110  - XAResource.start ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733393030303632:746D5F74737065782D6170702D636F6E7461696E65725F3131373538 , XAResource.TMNOFLAGS ) on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@4e49879a
159: 2012-06-12 11:13:39,822 [serviceTaskExecutor-5] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@ddc794a8 ) for transaction tm_tspex-app-container_10173900062
160: 2012-06-12 11:13:39,823 [serviceTaskExecutor-5] INFO  atomikos.println:110  - registerSynchronization ( com.atomikos.jdbc.AtomikosConnectionProxy$JdbcRequeueSynchronization@ddc794a8 ) for transaction tm_tspex-app-container_10173900062
161: 2012-06-12 11:13:39,824 [serviceTaskExecutor-5] INFO  atomikos.println:110  - XAResource.end ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733393030303632:746D5F74737065782D6170702D636F6E7461696E65725F3131373538 , XAResource.TMSUCCESS ) on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@4e49879a
162: 2012-06-12 11:13:39,824 [serviceTaskExecutor-5] INFO  atomikos.println:110  - commit() done (by application) of transaction tm_tspex-app-container_10173900062
163: 2012-06-12 11:13:39,843 [Atomikos:8] INFO  atomikos.println:110  - XAResource.prepare ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733393030303632:746D5F74737065782D6170702D636F6E7461696E65725F3131373538 ) returning OK on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@4e49879a
164: 2012-06-12 11:13:39,843 [Atomikos:8] INFO  atomikos.println:110  - XAResource.commit ( 746D5F74737065782D6170702D636F6E7461696E65725F3130313733393030303632:746D5F74737065782D6170702D636F6E7461696E65725F3131373538 , false ) on resource MAIN-ATOMIKOS-CONNECTION represented by XAResource instance com.mysql.jdbc.jdbc2.optional.JDBC4SuspendableXAConnection@4e49879a




Last Resource Commit Optimization (LRCO)

Although the XA transaction protocol is designed to provide ACID properties by using a two-phase commit protocol, model may not always be appropriate. Sometimes it is necessary to allow a non-XA-aware resource manager to participate in a transaction. This is often the case with data stores that do not support distributed transactions.

In this situation, you can use a technique known as Last Resource Commit Optimization (LRCO). This is sometimes called the Last Resource Gambit. The one-phase-aware resource is processed last in the prepare phase of the transaction, at which time an attempt is made to commit it. If the attempt is successful, the transaction log is written and the remaining resources go through the phase-two commit. If the last resource fails to commit, the transaction is rolled back. Although this protocol allows most transactions to complete normally, some errors can cause an inconsistent transaction outcome. For this reason, use LRCO as a last resort. When a single is used in a transaction, the LRCO is automatically applied to it. In other situations, you can designate a last resource by using a special marker interface. Refer to the JBoss Transactions Programmer's Guide for more details.


Ref : http://docs.redhat.com/docs


Thursday, June 7, 2012

JTA Transaction Manager(XA) - Analysis


Requirements
We needs JTA complaint XA transaction manager since we have multiple resources
  • Database - Mysql
  • Cache - Infinispan
Both of these resources support XA - JTA transactions. - Mysql through com.mysql.jdbc.jdbc2.optional.MysqlXADataSource.
Alternatives for transaction manager 
We also need to choose a connection pool framework for database which is XA complaint. Hence options
Picking the right combination
  1. Atomokis transaction Manager + Atomikos connection pooling 
  • Easy configurations with Spring
  • JTA implementation comes with connection Pooling & Datasource (no need of seperate JCA)
  • Does support synchronization
  • Does not support last resource optimization
2. Jboss transaction Manager

      Jboss does not come with default connection pool  or JCA to be used in Standalone mode. Hence it is ideal with server liek Jboss and not in standalone mode
       Issues 
   1. Tried Jboss TM + DBCl Connection pool(XA) as suggested in  - http://lafernando.com/2011/01/05/xa-transactions-with-apache-dbcp/
   Faced issues were in connections got exhasted and where not returned to the pool
  2. Then tried to replace DBCP with Tomcat jdbc pool - which is the advanced version of dbcp overcoming its drawbacks
   Even though jdbc pool claims to have XA support , did not find much info about it in the net. When I tried the datasource did not seem to take part in the transaction.
 So the optiosn for JCA where 
Both these did not have any great documentation for use in standalone environment.
Based on all the above we will switch back to Atomikos  because
  1. It has Support
  2. Good documentation/ examples
  3. Seems to be widely used

Tuesday, May 22, 2012

Different Serialization - Java Serialization, Jboss Serilaization & Externalization


Hi I have just compared 3 serialization strategies - only in terms of payload data and here are the results entitiy includes - Few Longs, Strings, BigDecimal, Dates , Enums etc Default Java Serialization
 @Test
 public void testJavaSerialization() throws IOException, ClassNotFoundException {
        Trade trade = new BuyTrade();
        trade.setOid(128245);
        trade.setVersion(10);
        
        trade.setOrderId(13212);
        trade.setProductId(876);
        trade.setAccountId(1234L);
        
        trade.setDateMatched(org.joda.time.DateTime.now());
        
        trade.setPrice(new BigDecimal("213.23"));
        trade.setVolume(10);
        trade.setState(TradeState.PENDING);
        trade.setOpenVolume(10);
        trade.setType(TradeType.SETTLEMENT);
 
        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        ObjectOutputStream oout = new ObjectOutputStream(bout);
        oout.writeObject(trade);
        byte[] bytes = bout.toByteArray();
        System.out.println("Java Serialization :" + bytes.length);
        
        Trade deSerializedTrade = null;
        
        //deserialze
        ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
        ObjectInputStream out = new ObjectInputStream(bin);
        deSerializedTrade = (Trade) out.readObject();
        
   
 }

Default Java Serialization - 1127 bytes Jboss Serialization
 @Test
 public void testJbossSerialization() throws IOException, ClassNotFoundException {
        Trade trade = new BuyTrade();
        trade.setOid(128245);
        trade.setVersion(10);
        
        trade.setOrderId(13212);
        trade.setProductId(876);
        trade.setAccountId(1234L);
        
        trade.setDateMatched(org.joda.time.DateTime.now());        
        trade.setPrice(new BigDecimal("213.23"));
        trade.setVolume(10);
        trade.setState(TradeState.PENDING);
        trade.setOpenVolume(10);
        trade.setType(TradeType.SETTLEMENT);
 
        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        JBossObjectOutputStream oout = new JBossObjectOutputStream(bout);
        oout.writeObject(trade);
        byte[] bytes = bout.toByteArray();
        System.out.println("JBoss Serialization :" + bytes.length);
        
        Trade deSerializedTrade = null;
        
        //deserialze
        ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
        JBossObjectInputStream out = new JBossObjectInputStream(bin);
        deSerializedTrade = (Trade) out.readObject();
        
    }

Jboss Serialization – 1125 bytes Externalization
 @Test
 public void testExternalizableSerialization() throws IOException, ClassNotFoundException {
        ExternalizedTrade trade = new ExternalizedTrade();
        trade.setOid(128245);
        trade.setVersion(10);
        trade.setWritable(false);
        
        trade.setOrderId(13212);
        trade.setProductId(876);
        trade.setAccountId(1234L);
        
        trade.setDateMatched(org.joda.time.DateTime.now());
        trade.setPrice(new BigDecimal("213.23"));
        trade.setVolume(10);
        trade.setState(TradeState.PENDING);
        trade.setOpenVolume(10);
        trade.setType(TradeType.SETTLEMENT);
 
        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        ObjectOutputStream oout = new ObjectOutputStream(bout);
        oout.writeObject(trade);
        byte[] bytes = bout.toByteArray();
        System.out.println("Externalizable Serialization :" + bytes.length);
        
        //deserialze
        Trade deSerializedTrade = null;
        ByteArrayInputStream bin = new ByteArrayInputStream(bytes);
        ObjectInputStream out = new ObjectInputStream(bin);
        deSerializedTrade = (ExternalizedTrade) out.readObject();
  
 }


 @Override
 public void readExternal(ObjectInput input) throws IOException,
   ClassNotFoundException {
  setBias(OrderBias.lookupOrderBiasById((new Long(input.readByte()))));

  setOid(input.readLong());
  setVersion((new Long(input.readInt())));
  setWritable(input.readBoolean());
  
  setOrderId(input.readLong());
  setProductId((new Long(input.readInt())));
  setAccountId(input.readLong());
  setDateMatched((org.joda.time.DateTime)input.readObject());
  setPrice(new BigDecimal((String)input.readObject()));
  setVolume((new Long(input.readInt())));
  setState(TradeState.lookupTradeStateById((new Long(input.readByte()))));
  setOpenVolume((new Long(input.readInt())));
  setType(TradeType.lookupTradeStateById((new Long(input.readByte()))));
  
 }
 
 @Override
 public void writeExternal(ObjectOutput output) throws IOException {
  output.writeByte(((Long)getBias().getId()).intValue());
  
  output.writeLong(getOid());
  output.writeInt(((Long)getVersion()).intValue());
  output.writeBoolean(isWritable());

  output.writeLong(getOrderId());
  output.writeInt(((Long)getProductId()).intValue());
  output.writeLong(getAccountId());
  output.writeObject(getDateMatched());
  output.writeObject(getPrice().toString());
  output.writeInt(((Long)getVolume()).intValue());
  output.writeByte(((Long)getState().getId()).intValue());
  output.writeInt(((Long)getOpenVolume()).intValue());
  output.writeByte(((Long)getType().getId()).intValue());
 }

 
Externalizable - 999 bytes

  Notes :

1. BigDecimal - when serialized as Strings has 60% less payload when compared to bytes.

 2. Date - Calendar is a very heavy to serialize when compared to its counterpart Joda Date time

 3. Enums - can be write efficiently serialized. Ref :

Wednesday, May 16, 2012

Spring Configurations for JTA Transaction - XA datasource (Mysql) + Jboss Transaction manager(Arjuna) + Spring Transaction annotations + DBCP Connection pooling

Mysql complaint mysql xa datasource and Atomikos connection pooling

     
   
   
   
     
  
   
        
        
    

    
     
     
    
    
    
        
        
        
        
        false
        true
    

    
    
        
  
    


Jboss transaction manager settings

 
 


 
 

 


 
  
   
  
  
   
  
 

Maven dependencies for dbcp and jboss transaction manager

              4.16.4.Final

  
    commons-dbcp
    commons-dbcp
    1.4
  

  
   org.jboss.jbossts
   jbossjta
   ${jboss.jta.version}
  




Friday, May 11, 2012

Spring Configuratiosn for JTA Transaction - XA datasource (Mysql) + Atomikos Transaction manager + Spring Transaction annotations





Mysql complaint mysql xa datasource  and Atomikos connection pooling



 <bean id="dataSource" class="com.atomikos.jdbc.AtomikosDataSourceBean"
  init-method="init" destroy-method="close">
  <property name="uniqueResourceName" value="MAIN-ATOMIKOS-CONNECTION" />
  <property name="poolSize" value="${initialSize}" />
  <property name="xaDataSourceClassName"
   value="com.mysql.jdbc.jdbc2.optional.MysqlXADataSource" />
  <property name="xaProperties" ref="databaseProperties" />
  <property name="testQuery" value="select 1" />
 </bean>




database.properties


<util:properties id="databaseProperties"
  location="classpath:database.properties" />



url=jdbc\:mysql\://localhost\:3306/<DBNAME>
user=root
password=
autoReconnect=true
autoReconnectForConnectionPools=true
autoReconnectForPools=true
pinGlobalTxToPhysicalConnection=true


Transaction specific Config

Following settings are for enabling transactions

<tx:annotation-driven transaction-manager="transactionManager" />

<bean id="atomikosTransactionManager" class="com.atomikos.icatch.jta.UserTransactionManager" 
  init-method="init" destroy-method="close"> 
           <property name="forceShutdown"> <value>true</value> </property> 
</bean>

<bean id="atomikosUserTransaction" 
  class="com.atomikos.icatch.jta.UserTransactionImp">
            <property name="transactionTimeout" 
  value="300"/> 
</bean> 

<bean id="transactionManager" class="org.springframework.transaction.jta.JtaTransactionManager"> 
  <property name="transactionManager"> <ref bean="atomikosTransactionManager" 
  /> </property> 
              <property name="userTransaction"> <ref bean="atomikosUserTransaction" 
  /> </property> 
</bean> 




Just adding spring Spring annotation - will now enable transaction on required methods.


Wednesday, March 21, 2012

Finding java thread which takes highest CPU

1 .Get the process id of java process

ps -aefww

2. Get all threads and CPU it consumes

ps -eLo pid,lwp,nlwp,ruser,pcpu,stime,etime,args|grep PROCESS ID

Convert llwp from decimal to hex (so 8245 would be 2035)

3. Take thread dump of java process

now open the thread dump with text editor and search for 2035, you will find something similar:
"TP-Processor234786" daemon prio=10 tid=0x00002aaad8024800 nid=0x2035 runnable [0x00002aaadef29000]
java.lang.Thread.State: RUNNABLE
at java.util.HashMap.get(HashMap.java:303)
at ......


Ref :http://javadrama.blogspot.co.uk/2012/02/why-is-java-eating-my-cpu.html

 
Free Domain Names @ .co.nr!