This reverts commit c50b6c39ba.
This commit is contained in:
Timothy Bish 2014-01-06 09:32:46 -05:00
parent ed66e3b341
commit 97b12c7245
6 changed files with 12 additions and 28 deletions

View File

@ -155,7 +155,7 @@ class CallerBufferingDataFileAppender extends DataFileAppender {
}
if (forceToDisk) {
file.getChannel().force(false);
file.getFD().sync();
}
Journal.WriteCommand lastWrite = wb.writes.getTail();

View File

@ -155,7 +155,7 @@ final class DataFileAccessor {
int size = Math.min(data.getLength(), location.getSize());
file.write(data.getData(), data.getOffset(), size);
if (sync) {
file.getChannel().force(false);
file.getFD().sync();
}
}

View File

@ -365,7 +365,7 @@ class DataFileAppender implements FileAppender {
}
if (forceToDisk) {
file.getChannel().force(false);
file.getFD().sync();
}
Journal.WriteCommand lastWrite = wb.writes.getTail();

View File

@ -610,10 +610,10 @@ public class PageFile {
// So we don't loose it.. write it 2 times...
writeFile.seek(0);
writeFile.write(d);
writeFile.getChannel().force(false);
writeFile.getFD().sync();
writeFile.seek(PAGE_FILE_HEADER_SIZE / 2);
writeFile.write(d);
writeFile.getChannel().force(false);
writeFile.getFD().sync();
}
private void storeFreeList() throws IOException {
@ -1081,9 +1081,9 @@ public class PageFile {
if (enableDiskSyncs) {
// Sync to make sure recovery buffer writes land on disk..
if (enableRecoveryFile) {
recoveryFile.getChannel().force(false);
recoveryFile.getFD().sync();
}
writeFile.getChannel().force(false);
writeFile.getFD().sync();
}
} finally {
synchronized (writes) {
@ -1185,7 +1185,7 @@ public class PageFile {
}
// And sync it to disk
writeFile.getChannel().force(false);
writeFile.getFD().sync();
return nextTxId;
}

View File

@ -233,9 +233,9 @@ public class DiskBenchmark {
}
// Sync to disk so that the we actually write the data to disk.. otherwise
// OS buffering might not really do the write.
raf.getChannel().force(false);
raf.getFD().sync();
}
raf.getChannel().force(false);
raf.getFD().sync();
raf.close();
now = System.currentTimeMillis();
@ -254,7 +254,7 @@ public class DiskBenchmark {
for( long i=0; i+data.length < size; i+=data.length) {
raf.seek(i);
raf.write(data);
raf.getChannel().force(false);
raf.getFD().sync();
ioCount++;
now = System.currentTimeMillis();
if( (now-start)>sampleInterval ) {

View File

@ -16,12 +16,7 @@
*/
package org.apache.activemq.util;
import java.io.File;
import java.io.FileDescriptor;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.io.*;
public class RecoverableRandomAccessFile implements java.io.DataOutput, java.io.DataInput, java.io.Closeable {
@ -393,17 +388,6 @@ public class RecoverableRandomAccessFile implements java.io.DataOutput, java.io.
throw ioe;
}
}
public FileChannel getChannel() throws IOException {
try {
return getRaf().getChannel();
} catch (IOException ioe)
{
handleException();
throw ioe;
}
}
public int read(byte[] b, int off, int len) throws IOException {
try {