Author: gtully
Date: Thu Nov 5 17:07:57 2009
New Revision: 833082
URL: http://svn.apache.org/viewvc?rev=833082&view=rev
Log:
merge 833074 - 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
Modified:
activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFile.java
Modified: activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFile.java
URL: http://svn.apache.org/viewvc/activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFile.java?rev=833082&r1=833081&r2=833082&view=diff
==============================================================================
--- activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFile.java
(original)
+++ activemq/branches/activemq-5.3/activemq-core/src/main/java/org/apache/activemq/kaha/impl/async/DataFile.java
Thu Nov 5 17:07:57 2009
@@ -88,10 +88,19 @@
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;
|