Last active
August 29, 2015 14:00
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
@Service | |
public class LongRunningServiceImpl implements LongRunningService { | |
@Override | |
public CallableFuture<String> someLongRunningTask() { | |
final CallableFuture<String> future = | |
CallableFutureFactory.get().createFuture(String.class); | |
// Start some asynchronous, potentially slow computation | |
SomeSlowStringComputation slow = new SomeSlowStringComputation(); | |
slow.start(new ResultCallback<String>() { | |
public void onResult(String result) { | |
future.setValue(result); | |
} | |
}); | |
return future; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment