User: dsundstrom Date: 02/04/14 20:25:49 Modified: src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge JDBCCMP1xFieldBridge.java JDBCCMP2xFieldBridge.java JDBCCMRFieldBridge.java Log: Fixed bug [ 543799 ] read-time-out = 0 always times out read-time-out == 0 means that the data always times out read-time-out == -1 means that the data never times out Revision Changes Path 1.13 +13 -8 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCCMP1xFieldBridge.java Index: JDBCCMP1xFieldBridge.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCCMP1xFieldBridge.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- JDBCCMP1xFieldBridge.java 11 Apr 2002 16:39:21 -0000 1.12 +++ JDBCCMP1xFieldBridge.java 15 Apr 2002 03:25:49 -0000 1.13 @@ -35,7 +35,7 @@ * One for each entity bean cmp field. * * @author <a href="mailto:[EMAIL PROTECTED]">Dain Sundstrom</a> - * @version $Revision: 1.12 $ + * @version $Revision: 1.13 $ */ public class JDBCCMP1xFieldBridge extends JDBCAbstractCMPFieldBridge { private Field field; @@ -117,14 +117,19 @@ } public boolean isReadTimedOut(EntityEnterpriseContext ctx) { - if(isReadOnly()) { - long readInterval = System.currentTimeMillis() - - getFieldState(ctx).lastRead; - return readInterval > getReadTimeOut(); - } - // if we are read/write then we are always timed out - return true; + if(!isReadOnly()) { + return true; + } + + // if read-time-out is -1 then we never time out. + if(getReadTimeOut() == -1) { + return false; + } + + long readInterval = System.currentTimeMillis() - + getFieldState(ctx).lastRead; + return readInterval >= getReadTimeOut(); } public void resetPersistenceContext(EntityEnterpriseContext ctx) { 1.13 +13 -8 jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCCMP2xFieldBridge.java Index: JDBCCMP2xFieldBridge.java =================================================================== RCS file: /cvsroot/jboss/jboss/src/main/org/jboss/ejb/plugins/cmp/jdbc/bridge/JDBCCMP2xFieldBridge.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- JDBCCMP2xFieldBridge.java 11 Apr 2002 16:39:21 -0000 1.12 +++ JDBCCMP2xFieldBridge.java 15 Apr 2002 03:25:49 -0000 1.13 @@ -33,7 +33,7 @@ * One for each entity bean cmp field. * * @author <a href="mailto:[EMAIL PROTECTED]">Dain Sundstrom</a> - * @version $Revision: 1.12 $ + * @version $Revision: 1.13 $ */ public class JDBCCMP2xFieldBridge extends JDBCAbstractCMPFieldBridge { @@ -118,14 +118,19 @@ } public boolean isReadTimedOut(EntityEnterpriseContext ctx) { - if(isReadOnly()) { - long readInterval = System.currentTimeMillis() - - getFieldState(ctx).lastRead; - return readInterval > getReadTimeOut(); - } - // if we are read/write then we are always timed out - return true; + if(!isReadOnly()) { + return true; + } + + // if read-time-out is -1 then we never time out. + if(getReadTimeOut() == -1) { + return false; + } + + long readInterval = System.currentTimeMillis() - + getFieldState(ctx).lastRead; + return readInterval >= getReadTimeOut(); } public FieldState getFieldState(EntityEnterpriseContext ctx) { 1.31 +13 -8 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.30 retrieving revision 1.31 diff -u -r1.30 -r1.31 --- JDBCCMRFieldBridge.java 12 Apr 2002 21:39:48 -0000 1.30 +++ JDBCCMRFieldBridge.java 15 Apr 2002 03:25:49 -0000 1.31 @@ -57,7 +57,7 @@ * One for each role that entity has. * * @author <a href="mailto:[EMAIL PROTECTED]">Dain Sundstrom</a> - * @version $Revision: 1.30 $ + * @version $Revision: 1.31 $ */ public class JDBCCMRFieldBridge implements JDBCFieldBridge, CMRFieldBridge { // ------ Invocation messages ------ @@ -525,14 +525,19 @@ * Had the read time expired? */ public boolean isReadTimedOut(EntityEnterpriseContext ctx) { - if(isReadOnly()) { - long readInterval = System.currentTimeMillis() - - getFieldState(ctx).getLastRead(); - return readInterval > getRelationMetaData().getReadTimeOut(); - } - // if we are read/write then we are always timed out - return true; + if(!isReadOnly()) { + return true; + } + + // if read-time-out is -1 then we never time out. + if(getRelationMetaData().getReadTimeOut() == -1) { + return false; + } + + long readInterval = System.currentTimeMillis() - + getFieldState(ctx).getLastRead(); + return readInterval > getRelationMetaData().getReadTimeOut(); } public Object getValue(EntityEnterpriseContext ctx) {
_______________________________________________ Jboss-development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development