git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@835833 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Bosanac Dejan 2009-11-13 12:56:38 +00:00
parent f528aa5b1d
commit 6a4e25c737
1 changed files with 14 additions and 3 deletions

View File

@ -21,6 +21,7 @@ import java.io.InterruptedIOException;
import java.io.RandomAccessFile;
import java.util.Map;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicReference;
import java.util.zip.Adler32;
import java.util.zip.Checksum;
@ -85,6 +86,7 @@ class DataFileAppender {
public final CountDownLatch latch = new CountDownLatch(1);
private final int offset;
public int size = Journal.BATCH_CONTROL_RECORD_SIZE;
public AtomicReference<IOException> exception = new AtomicReference<IOException>();
public WriteBatch(DataFile dataFile, int offset, WriteCommand write) throws IOException {
this.dataFile = dataFile;
@ -184,6 +186,10 @@ class DataFileAppender {
} catch (InterruptedException e) {
throw new InterruptedIOException();
}
IOException exception = batch.exception.get();
if (exception != null) {
throw exception;
}
}
return location;
@ -404,11 +410,16 @@ class DataFileAppender {
wb.latch.countDown();
}
} catch (IOException e) {
if (wb != null) {
wb.latch.countDown();
}
synchronized (enqueueMutex) {
firstAsyncException = e;
if (wb != null) {
wb.latch.countDown();
wb.exception.set(e);
}
if (nextWriteBatch != null) {
nextWriteBatch.latch.countDown();
nextWriteBatch.exception.set(e);
}
}
} catch (InterruptedException e) {
} finally {