Skip to content

Instantly share code, notes, and snippets.

@disc99
Last active December 20, 2015 06:04
Show Gist options
  • Save disc99/111182f6867ed7d56c3c to your computer and use it in GitHub Desktop.
Save disc99/111182f6867ed7d56c3c to your computer and use it in GitHub Desktop.
public class FileSystemTest {
@Test
public void t1() throws Exception {
long startModified = f.lastModified();
Observable.interval(5, TimeUnit.SECONDS)
.map(i -> {
System.out.println("map ");
long l = f.lastModified();
if (l % 3 == 0) {
throw new RuntimeException();
}
return l;
})
.scan(startModified, (l, n) -> {
System.out.println(l+":"+n);
if (!l.equals(n)) {
System.out.println("Change!!");
return n;
}
return l;
})
.retry((i, e) -> {
System.out.println(e + ", total error: " + i);
return true;
})
.subscribe();
Thread.sleep(100000);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment