-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
evaluate the possibility of Future API surface #533
Comments
additional information: Future API seems to be here since API level 1 https://developer.android.com/reference/java/util/concurrent/FutureTask?hl=en and java 7 https://docs.oracle.com/javase/7/docs/api/java/util/concurrent/Future.html |
alternatively the azure identity is using Mono, which requires API level 26 but apparently has a better design |
alternatively, android had asyncTask |
update: whatever solution we come up with should work with API level 21. |
additionally, most http client libraries seem to be providing a native support for Futures (not okhttpclient though) |
alternatively, CompletableFuture API level 24 (java allows for chaining the futures (comparatively to "plain" futures) |
Recap of the solution and work to be done: We might need to rely on guava's ListenableFutures to chain the work as basic Futures don't seem to provide that kind of support and as CompletableFuture is only available on API level 24. Lastly, we'll keep providing a synchronous API to align with Azure SDKs
|
Update, after investigating and looking in depth at telemetry, we'll switch to CompletableFutures and raise the API level to 26 see the original comment |
Context: java's equivalent to Promises/Tasks are Futures. Adding an API surface that returns Futures (and potentially removing the callback one??) would enable our customers to write modern Java in their applications
I suppose so but my callback wrapper is pretty straightforward; it wasn't a huge deal writing it.
By far the biggest issue with using graph are the very restrictive rate limits... I shimmed a "rate limiter" into the above wrapper so I'm able to limit both number of simultaneous connections as well as ensure uploads don't go over the 15mb/30 sec limit. It took a lot of trial and error getting the futures passed just right so I didn't go over the max 4 connection cap, but it seems to be working well in practice.
Originally posted by @lespea in https://github.com/microsoftgraph/msgraph-sdk-java/issue_comments/705202102
AB#6315
The text was updated successfully, but these errors were encountered: