Commit f9661b53 by tonihei Committed by Oliver Woodman

Use Handler callback instead of sleep() to catch InteruptedException.

The sleep used to simulate data load times is ignoring InterruptedExceptions.
(This is intended and in line with SystemClock.sleep()). However, when a
Loader cancels an ongoing load, it uses interrupts. To be able to catch these
and to immediately return from the reading data source, a handler callback
is used instead of the sleep() method which allows interuptable waiting.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=168212652
parent c4bf83dd
......@@ -217,7 +217,7 @@ public class FakeDataSource implements DataSource {
return dataSpecs;
}
protected void onDataRead(int bytesRead) {
protected void onDataRead(int bytesRead) throws IOException {
// Do nothing. Can be overridden.
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment