From: Dain S. <dsu...@us...> - 2002-07-11 00:23:36
|
User: dsundstrom Date: 02/07/10 17:23:35 Modified: src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge Tag: Branch_3_0 JDBCCMRFieldBridge.java Log: Fix for bug [ 575815 ] CMR and commit option A. This fix invalidates the entire FieldState after transaction commits instead of just the setHandle. The problem with commit option A is the field is not reset so the RelationSet was never reset to null but always had a bad set handle. Revision Changes Path No revision No revision 1.31.2.5 +19 -14 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCCMRFieldBridge.java Index: JDBCCMRFieldBridge.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCCMRFieldBridge.java,v retrieving revision 1.31.2.4 retrieving revision 1.31.2.5 diff -u -r1.31.2.4 -r1.31.2.5 --- JDBCCMRFieldBridge.java 26 Jun 2002 16:53:51 -0000 1.31.2.4 +++ JDBCCMRFieldBridge.java 11 Jul 2002 00:23:35 -0000 1.31.2.5 @@ -1128,7 +1128,8 @@ // crete the relation set and register for a tx callback relationSet = new RelationSet( JDBCCMRFieldBridge.this, ctx, setHandle); - TxSynchronization sync = new TxSynchronization(setHandle); + TxSynchronization sync = + new TxSynchronization(FieldState.this); tx.registerSynchronization(sync); } else { @@ -1155,7 +1156,10 @@ return lastRead; } public void invalidate() { - setHandle[0] = null; + if(setHandle != null && setHandle.length > 0) + { + setHandle[0] = null; + } setHandle = null; relationSet = null; } @@ -1225,16 +1229,18 @@ throw new UnsupportedOperationException(); } } - private final static class TxSynchronization implements Synchronization { - private final WeakReference setHandleRef; + + private final static class TxSynchronization implements Synchronization + { + private final WeakReference fieldStateRef; - private TxSynchronization(List[] setHandle) + private TxSynchronization(FieldState fieldState) { - if(setHandle == null || setHandle.length != 1) { - throw new IllegalArgumentException("setHandle must be an array " + - "of length 1: " + setHandle); + if(fieldState == null) + { + throw new IllegalArgumentException("fieldState is null"); } - this.setHandleRef = new WeakReference(setHandle); + this.fieldStateRef = new WeakReference(fieldState); } public void beforeCompletion() @@ -1244,11 +1250,10 @@ public void afterCompletion(int status) { - List[] setHandle = (List[])setHandleRef.get(); - if(setHandle != null) { - setHandle[0] = null; + FieldState fieldState = (FieldState)fieldStateRef.get(); + if(fieldState != null) { + fieldState.invalidate(); } } } - } |