Last active
December 20, 2015 06:04
-
-
Save disc99/111182f6867ed7d56c3c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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