Skip to content

Commit

Permalink
0001528: Routing can get stuck if there are lots of gaps that range a…
Browse files Browse the repository at this point in the history
…cross a large amount of data that has already been routed
  • Loading branch information
chenson42 committed Jan 14, 2014
1 parent 84d2113 commit 35c25d2
Showing 1 changed file with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ protected void execute() {
if (cursor != null) {
cursor.close();
}
copyToQueue(new EOD());
reading = false;
copyToQueue(new EOD());
}

}
Expand All @@ -191,13 +191,18 @@ protected boolean process(Data data) {
}

public Data take() throws InterruptedException {
Data data = dataQueue.poll(takeTimeout, TimeUnit.SECONDS);

if (data == null) {
throw new SymmetricException("The read of the data to route queue has timed out");
} else if (data instanceof EOD) {
data = null;
}
Data data = null;
do {
data = dataQueue.poll(takeTimeout, TimeUnit.SECONDS);

if (data == null && !reading) {
throw new SymmetricException("The read of the data to route queue has timed out");
} else if (data instanceof EOD) {
data = null;
}

} while (data == null && reading);

return data;
}

Expand Down

0 comments on commit 35c25d2

Please sign in to comment.