mirror of https://github.com/apache/activemq.git
resolve https://issues.apache.org/activemq/browse/AMQ-2478 - patch applied with thanks. test case works with the new kahaDB also, it is a little neater w.r.t exception handling
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@833074 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
652d551063
commit
46a7f9eeab
|
@ -88,10 +88,19 @@ public class DataFile extends LinkedNode implements Comparable<DataFile> {
|
|||
public synchronized RandomAccessFile openRandomAccessFile(boolean appender) throws IOException {
|
||||
RandomAccessFile rc = new RandomAccessFile(file, "rw");
|
||||
// When we start to write files size them up so that the OS has a chance
|
||||
// to allocate the file contigously.
|
||||
// to allocate the file contiguously.
|
||||
if (appender) {
|
||||
if (length < preferedSize) {
|
||||
rc.setLength(preferedSize);
|
||||
try {
|
||||
// this can throw if we run out of disk space
|
||||
rc.setLength(preferedSize);
|
||||
} catch (IOException ioe) {
|
||||
try {
|
||||
rc.close();
|
||||
} catch(Exception ignored) {
|
||||
}
|
||||
throw ioe;
|
||||
}
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
|
|
Loading…
Reference in New Issue