[armedbear-cvs] r11984 - trunk/abcl/src/org/armedbear/lisp/util
Erik Huelsmann
ehuelsmann at common-lisp.net
Mon Jun 1 20:52:20 UTC 2009
Author: ehuelsmann
Date: Mon Jun 1 16:52:17 2009
New Revision: 11984
Log:
Delete the fcnsize field: in a multiprocessing
environment, this is one huge race. Also, its value
isn't used for anything but bookkeeping anymore.
Modified:
trunk/abcl/src/org/armedbear/lisp/util/RandomAccessCharacterFile.java
Modified: trunk/abcl/src/org/armedbear/lisp/util/RandomAccessCharacterFile.java
==============================================================================
--- trunk/abcl/src/org/armedbear/lisp/util/RandomAccessCharacterFile.java (original)
+++ trunk/abcl/src/org/armedbear/lisp/util/RandomAccessCharacterFile.java Mon Jun 1 16:52:17 2009
@@ -258,7 +258,6 @@
private RandomAccessInputStream inputStream;
private RandomAccessOutputStream outputStream;
private FileChannel fcn;
- private long fcnsize; /* the file size */
private Charset cset;
private CharsetEncoder cenc;
@@ -280,7 +279,6 @@
public RandomAccessCharacterFile(RandomAccessFile raf, String encoding) throws IOException {
fcn = raf.getChannel();
- fcnsize = fcn.size();
cset = (encoding == null) ? Charset.defaultCharset() : Charset.forName(encoding);
cdec = cset.newDecoder();
@@ -393,11 +391,6 @@
while (cbuf.remaining() > 0) {
CoderResult r = cenc.encode(cbuf, bbuf, endOfFile);
bbufIsDirty = true;
- long curpos = bbufpos + bbuf.position();
- if (curpos > fcnsize) {
- // the file is extended.
- fcnsize = curpos;
- }
if (CoderResult.OVERFLOW == r || bbuf.remaining() == 0) {
flushBbuf();
bbuf.clear();
@@ -515,7 +508,6 @@
if (bbufIsDirty)
flushBbuf();
fcn.write(ByteBuffer.wrap(b, off, len));
- fcnsize = fcn.size();
}
while (pos < off + len) {
int want = len;
@@ -525,11 +517,6 @@
bbuf.put(b, pos, want);
pos += want;
bbufIsDirty = true;
- long curpos = bbufpos + bbuf.position();
- if (curpos > fcnsize) {
- // the file is extended.
- fcnsize = curpos;
- }
if (bbuf.remaining() == 0) {
flushBbuf();
bbuf.clear();
More information about the armedbear-cvs
mailing list