Skip to content

Instantly share code, notes, and snippets.

@mindwing
Last active June 8, 2016 05:26
Show Gist options
  • Save mindwing/4e9cd9b7be62cfb4eb38f40e794658db to your computer and use it in GitHub Desktop.
Save mindwing/4e9cd9b7be62cfb4eb38f40e794658db to your computer and use it in GitHub Desktop.
Agera Explained - 08.Incrementally Agerifying legacy code
public class NetworkCallingFunction
implements Function<RequestBlob, Result<ResponseBlob>> {
@Override
public Result<ResponseBlob> apply(RequestBlob request) {
try {
ResponseBlob blob = networkStack.execute(request);
return Result.success(blob);
} catch (Throwable e) {
return Result.failure(e);
}
}
}
Function<RequestBlob, Result<ResponseBlob>> networkCallingFunction =
new NetworkCallingFunction();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment