From: <tho...@us...> - 2011-03-08 15:15:09
|
Revision: 4282 http://bigdata.svn.sourceforge.net/bigdata/?rev=4282&view=rev Author: thompsonbry Date: 2011-03-08 15:15:03 +0000 (Tue, 08 Mar 2011) Log Message: ----------- Javadoc edit to RWStore's reopen. A Modified Paths: -------------- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/journal/WORMStrategy.java branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/journal/WORMStrategy.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/journal/WORMStrategy.java 2011-03-08 15:12:43 UTC (rev 4281) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/journal/WORMStrategy.java 2011-03-08 15:15:03 UTC (rev 4282) @@ -1426,8 +1426,24 @@ */ private FileChannel reopenChannel() throws IOException { - synchronized (opener) { + /* + * Note: This is basically a double-checked locking pattern. It is + * used to avoid synchronizing when the backing channel is already + * open. + */ + { + final RandomAccessFile tmp = raf; + if (tmp != null) { + final FileChannel channel = tmp.getChannel(); + if (channel.isOpen()) { + // The channel is still open. + return channel; + } + } + } + synchronized (opener) { + assertOpen(); if (raf != null && raf.getChannel().isOpen()) { Modified: branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java =================================================================== --- branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java 2011-03-08 15:12:43 UTC (rev 4281) +++ branches/QUADS_QUERY_BRANCH/bigdata/src/java/com/bigdata/rwstore/RWStore.java 2011-03-08 15:15:03 UTC (rev 4282) @@ -3149,14 +3149,7 @@ if (tmp != null) { final FileChannel channel = tmp.getChannel(); if (channel.isOpen()) { - /* - * The channel is still open. If you are allowing - * concurrent reads on the channel, then this could - * indicate that two readers each found the channel - * closed and that one was able to re-open the channel - * before the other such that the channel was open again - * by the time the 2nd reader got here. - */ + // The channel is still open. return channel; } } @@ -3167,6 +3160,14 @@ if (raf != null) { final FileChannel channel = raf.getChannel(); if (channel.isOpen()) { + /* + * The channel is still open. If you are allowing + * concurrent reads on the channel, then this could + * indicate that two readers each found the channel + * closed and that one was able to re-open the channel + * before the other such that the channel was open again + * by the time the 2nd reader got here. + */ return channel; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |