|
From: <tri...@us...> - 2007-11-20 07:22:04
|
Revision: 157
http://equanda.svn.sourceforge.net/equanda/?rev=157&view=rev
Author: triathlon98
Date: 2007-11-19 23:22:02 -0800 (Mon, 19 Nov 2007)
Log Message:
-----------
EQ-85 add refresh method
Modified Paths:
--------------
trunk/equanda-client/src/main/java/org/equanda/persistence/om/LazyList.java
Modified: trunk/equanda-client/src/main/java/org/equanda/persistence/om/LazyList.java
===================================================================
--- trunk/equanda-client/src/main/java/org/equanda/persistence/om/LazyList.java 2007-11-20 06:28:59 UTC (rev 156)
+++ trunk/equanda-client/src/main/java/org/equanda/persistence/om/LazyList.java 2007-11-20 07:22:02 UTC (rev 157)
@@ -36,16 +36,16 @@
/**
* Abstract base class for LazyList instances.
* <p/>
- * A LazyList tries to get the resultset in batches if possible. The batch size if configurable.
- * These batches are cached and the expiration timeout for this cache is also configurable.
+ * A LazyList tries to get the resultset in batches if possible. The batch size if configurable. These batches are
+ * cached and the expiration timeout for this cache is also configurable.
* <p/>
- * When an element is obtained, an attempt is made to get the data from the cache.
- * If the cache is stale (timeout exceeded), then the instance is refreshed (to minimize the number of full selectors).
+ * When an element is obtained, an attempt is made to get the data from the cache. If the cache is stale (timeout
+ * exceeded), then the instance is refreshed (to minimize the number of full selectors).
* <p/>
* For resultsets which cannot be batched (ADD on subselects), the full list of UOIDs for the elements is maintained.
* <p/>
- * Depending on some conditions, it is possible that the size() method does not function.
- * In that case it will throw an exception. isEmpty should always function.
+ * Depending on some conditions, it is possible that the size() method does not function. In that case it will throw an
+ * exception. isEmpty should always function.
* <p/>
* The behaviour is optimized for (forward) iteration of the list.
*
@@ -136,9 +136,8 @@
private int endOfCache; // index just past the last element (in the results) (may be first of the next batch)
/**
- * Timestamp after which cache is stale.
- * This is declared transient to cater for difference in time between the server and client system.
- * The timestamp is set when first accessed after serialization.
+ * Timestamp after which cache is stale. This is declared transient to cater for difference in time between the
+ * server and client system. The timestamp is set when first accessed after serialization.
*/
private transient long timeCache; // timestamp after which cache is stale
@@ -244,7 +243,7 @@
// size() should still be done for selector with SubSelects and "add" operator
long min = Math.min( getCacheCapacity(), fullSize() - index );
size = ( min > Integer.MAX_VALUE ) ? Integer.MAX_VALUE : (int) min;
- UOID[] uoids = new UOID[ size ];
+ UOID[] uoids = new UOID[size];
for ( int i = 0; i < size ; i++ )
{
uoids[ i ] = getUOID( i + index );
@@ -484,7 +483,7 @@
throw new UnsupportedOperationException( "toArray() unsupported" );
}
- public <T>T[] toArray( T[] ts )
+ public <T> T[] toArray( T[] ts )
{
throw new UnsupportedOperationException( "toArray(T[]) unsupported" );
}
@@ -553,4 +552,14 @@
{
throw new UnsupportedOperationException( "subList(int,int) unsupported" );
}
+
+ /**
+ * refresh list, force release cache
+ */
+ public void refresh()
+ {
+ timeCache = 0;
+ cache = null;
+ data = null;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|