Author: shawkins
Date: 2011-10-08 23:25:35 -0400 (Sat, 08 Oct 2011)
New Revision: 3547
Modified:
trunk/engine/src/main/java/org/teiid/common/buffer/impl/FileStoreCache.java
Log:
TEIID-1750 correcting concurrency issues
Modified: trunk/engine/src/main/java/org/teiid/common/buffer/impl/FileStoreCache.java
===================================================================
--- trunk/engine/src/main/java/org/teiid/common/buffer/impl/FileStoreCache.java 2011-10-09
03:23:46 UTC (rev 3546)
+++ trunk/engine/src/main/java/org/teiid/common/buffer/impl/FileStoreCache.java 2011-10-09
03:25:35 UTC (rev 3547)
@@ -66,6 +66,7 @@
public class FileStoreCache implements Cache {
private static class CacheGroup {
+ private static final int RECLAIM_TAIL_SIZE = IO_BUFFER_SIZE << 5;
private static final int MAX_FREE_SPACE = 1 << 11;
FileStore store;
long tail;
@@ -83,7 +84,7 @@
if (info != null) {
if (info[0] + info[1] == tail) {
tail -= info[1];
- if (store.getLength() - tail > IO_BUFFER_SIZE << 5) {
+ if (store.getLength() - tail > RECLAIM_TAIL_SIZE) {
store.setLength(tail);
}
} else {
@@ -228,9 +229,9 @@
}
@Override
- protected int flushDirect() throws IOException {
- group.store.write(offset + bytesWritten, buffer.array(), 0, buf.position());
- return buf.position();
+ protected int flushDirect(int i) throws IOException {
+ group.store.write(offset + bytesWritten, buffer.array(), 0, i);
+ return i;
}
};
ObjectOutputStream oos = new ObjectOutputStream(fsos);
Show replies by date