Created
April 23, 2014 14:15
-
-
Save kpiwko/11216846 to your computer and use it in GitHub Desktop.
scheduling a callable for spacelift
This file contains hidden or 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
| Tasks.prepare(CreateFileTask.class) | |
| .named("target/foobar") | |
| .then(DataSampler.class) | |
| .generateRandomData(123) | |
| .then(FileReader.class) | |
| .then(ExecutionCounter.class) | |
| .execute().awaitUntil(3, TimeUnit.SECONDS, new ExecutionCondition<Integer>() { | |
| @Override | |
| public boolean satisfiedBy(Integer object) throws ExecutionException { | |
| return object >= 3; | |
| } | |
| }); | |
| // restart counter | |
| Tasks.prepare(ExecutionCounter.class).restart(); | |
| exception.expect(TimeoutExecutionException.class); | |
| Tasks.prepare(CreateFileTask.class) | |
| .named("target/foobar") | |
| .then(DataSampler.class) | |
| .generateRandomData(123) | |
| .then(FileReader.class) | |
| .then(ExecutionCounter.class) | |
| .execute() | |
| .pollEvery(1, TimeUnit.SECONDS).awaitUntil(3, TimeUnit.SECONDS, new ExecutionCondition<Integer>() { | |
| @Override | |
| public boolean satisfiedBy(Integer object) throws ExecutionException { | |
| return object >= 5; | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment