propogating interupted exception, so that resources can be closed when it is received.

This commit is contained in:
Rob Austin
2015-02-02 22:46:47 +00:00
parent 5f627dc6b4
commit 915c81f0e7
7 changed files with 90 additions and 45 deletions
@@ -191,7 +191,7 @@ final class ChannelProvider implements Closeable {
@Override
public boolean nextEntry(@NotNull EntryCallback callback,
final int na) {
final int na) throws InterruptedException {
channelDataLock.readLock().lock();
try {
for (int i = 0, len = chronicleChannelList.size(); i < len; i++) {
@@ -213,9 +213,13 @@ final class ChannelProvider implements Closeable {
channelDataLock.readLock().lock();
try {
for (int i = 0, len = chronicleChannelList.size(); i < len; i++) {
chronicleChannelList.get(i)
.acquireModificationIterator(remoteIdentifier, notifier)
.dirtyEntries(fromTimeStamp);
try {
chronicleChannelList.get(i)
.acquireModificationIterator(remoteIdentifier, notifier)
.dirtyEntries(fromTimeStamp);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
notifier.onChange();
}
} finally {
@@ -335,8 +339,12 @@ final class ChannelProvider implements Closeable {
// this could be null if one node has a chronicle channel before the other
if (chronicleChannels[chronicleChannel] != null) {
chronicleChannels[chronicleChannel].acquireModificationIterator(remoteIdentifier, NOP)
.dirtyEntries(lastModificationTime);
try {
chronicleChannels[chronicleChannel].acquireModificationIterator(remoteIdentifier, NOP)
.dirtyEntries(lastModificationTime);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
}
}