1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Cosmetics.

This commit is contained in:
Sergey Prigogin 2012-11-08 13:54:23 -08:00
parent b689c5bc37
commit 1eaf5662fe

View file

@ -91,9 +91,9 @@ public class Database {
private final File fLocation; private final File fLocation;
private final boolean fReadOnly; private final boolean fReadOnly;
private RandomAccessFile fFile; private RandomAccessFile fFile;
private boolean fExclusiveLock= false; // necessary for any write operation private boolean fExclusiveLock; // necessary for any write operation
private boolean fLocked; // necessary for any operation. private boolean fLocked; // necessary for any operation.
private boolean fIsMarkedIncomplete= false; private boolean fIsMarkedIncomplete;
private int fVersion; private int fVersion;
private final Chunk fHeaderChunk; private final Chunk fHeaderChunk;
@ -151,7 +151,7 @@ public class Database {
fFile.getChannel().read(buf, position); fFile.getChannel().read(buf, position);
return; return;
} catch (ClosedChannelException e) { } catch (ClosedChannelException e) {
// bug 219834 file may have be closed by interrupting a thread during an I/O operation. // Bug 219834 file may have be closed by interrupting a thread during an I/O operation.
reopen(e, ++retries); reopen(e, ++retries);
} }
} while (true); } while (true);
@ -164,14 +164,14 @@ public class Database {
fFile.getChannel().write(buf, position); fFile.getChannel().write(buf, position);
return; return;
} catch (ClosedChannelException e) { } catch (ClosedChannelException e) {
// bug 219834 file may have be closed by interrupting a thread during an I/O operation. // Bug 219834 file may have be closed by interrupting a thread during an I/O operation.
reopen(e, ++retries); reopen(e, ++retries);
} }
} }
} }
private void reopen(ClosedChannelException e, int attempt) throws ClosedChannelException, FileNotFoundException { private void reopen(ClosedChannelException e, int attempt) throws ClosedChannelException, FileNotFoundException {
// only if the current thread was not interrupted we try to reopen the file. // Only if the current thread was not interrupted we try to reopen the file.
if (e instanceof ClosedByInterruptException || attempt >= 20) { if (e instanceof ClosedByInterruptException || attempt >= 20) {
throw e; throw e;
} }
@ -187,7 +187,7 @@ public class Database {
while (position < size) { while (position < size) {
nRead = from.transferTo(position, 4096 * 16, target); nRead = from.transferTo(position, 4096 * 16, target);
if (nRead == 0) { if (nRead == 0) {
break; // should not happen break; // Should not happen
} else { } else {
position+= nRead; position+= nRead;
} }
@ -695,8 +695,7 @@ public class Database {
} }
// also handles header chunk // also handles header chunk
flushAndUnlockChunks(dirtyChunks, flush); flushAndUnlockChunks(dirtyChunks, flush);
} } finally {
finally {
fExclusiveLock= false; fExclusiveLock= false;
} }
} }