Last active
April 4, 2018 06:40
-
-
Save adamw/942022b7e7cd39243d0e80a5bf3e69bd to your computer and use it in GitHub Desktop.
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
| class Synchronous { | |
| // I/0 operations: blocking, synchronous | |
| <T> T fetchFromDb(Class<T> entityClass, long id) { return null; } | |
| String sendHttpGet(String url) { return null; } | |
| void sendEmail(String to, String content) { } | |
| // the business logic: synchronous | |
| void runBusinessProcess() { | |
| User user = fetchFromDb(User.class, 42); | |
| String profile = sendHttpGet( | |
| "http://profile_service/get/" + user.getProfileId()); | |
| sendEmail(user.getEmail(), "Your profile is: " + profile); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment