{"action":"closed","issue":{"url":"https://api.github.com/repos/firebase/firebase-admin-java/issues/55","repository_url":"https://api.github.com/repos/firebase/firebase-admin-java","labels_url":"https://api.github.com/repos/firebase/firebase-admin-java/issues/55/labels{/name}","comments_url":"https://api.github.com/repos/firebase/firebase-admin-java/issues/55/comments","events_url":"https://api.github.com/repos/firebase/firebase-admin-java/issues/55/events","html_url":"https://github.com/firebase/firebase-admin-java/issues/55","id":241876081,"number":55,"title":"FR: Revising the Threading Model and Async APIs","user":{"login":"hiranya911","id":2375201,"avatar_url":"https://avatars1.githubusercontent.com/u/2375201?v=4","gravatar_id":"","url":"https://api.github.com/users/hiranya911","html_url":"https://github.com/hiranya911","followers_url":"https://api.github.com/users/hiranya911/followers","following_url":"https://api.github.com/users/hiranya911/following{/other_user}","gists_url":"https://api.github.com/users/hiranya911/gists{/gist_id}","starred_url":"https://api.github.com/users/hiranya911/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hiranya911/subscriptions","organizations_url":"https://api.github.com/users/hiranya911/orgs","repos_url":"https://api.github.com/users/hiranya911/repos","events_url":"https://api.github.com/users/hiranya911/events{/privacy}","received_events_url":"https://api.github.com/users/hiranya911/received_events","type":"User","site_admin":false},"labels":[{"id":560678010,"url":"https://api.github.com/repos/firebase/firebase-admin-java/labels/enhancement","name":"enhancement","color":"84b6eb","default":true},{"id":613568000,"url":"https://api.github.com/repos/firebase/firebase-admin-java/labels/feature-request","name":"feature-request","color":"fbca04","default":false}],"state":"closed","locked":false,"assignee":{"login":"hiranya911","id":2375201,"avatar_url":"https://avatars1.githubusercontent.com/u/2375201?v=4","gravatar_id":"","url":"https://api.github.com/users/hiranya911","html_url":"https://github.com/hiranya911","followers_url":"https://api.github.com/users/hiranya911/followers","following_url":"https://api.github.com/users/hiranya911/following{/other_user}","gists_url":"https://api.github.com/users/hiranya911/gists{/gist_id}","starred_url":"https://api.github.com/users/hiranya911/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hiranya911/subscriptions","organizations_url":"https://api.github.com/users/hiranya911/orgs","repos_url":"https://api.github.com/users/hiranya911/repos","events_url":"https://api.github.com/users/hiranya911/events{/privacy}","received_events_url":"https://api.github.com/users/hiranya911/received_events","type":"User","site_admin":false},"assignees":[{"login":"hiranya911","id":2375201,"avatar_url":"https://avatars1.githubusercontent.com/u/2375201?v=4","gravatar_id":"","url":"https://api.github.com/users/hiranya911","html_url":"https://github.com/hiranya911","followers_url":"https://api.github.com/users/hiranya911/followers","following_url":"https://api.github.com/users/hiranya911/following{/other_user}","gists_url":"https://api.github.com/users/hiranya911/gists{/gist_id}","starred_url":"https://api.github.com/users/hiranya911/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hiranya911/subscriptions","organizations_url":"https://api.github.com/users/hiranya911/orgs","repos_url":"https://api.github.com/users/hiranya911/repos","events_url":"https://api.github.com/users/hiranya911/events{/privacy}","received_events_url":"https://api.github.com/users/hiranya911/received_events","type":"User","site_admin":false}],"milestone":null,"comments":31,"created_at":"2017-07-10T22:57:48Z","updated_at":"2018-05-11T20:47:06Z","closed_at":"2018-05-11T20:47:06Z","author_association":"MEMBER","body":"There are several issues in the Admin SDK with respect to how it creates and uses threads:\r\n\r\n1. Most public APIs are asynchronous, and returns `Task` instances. This tends to make implementing simple use cases unnecessarily complex (e.g. creating a custom token and sending back as a servlet response).\r\n2. Main thread pool is initialized statically, and not configurable.\r\n3. `ThreadFactory` is initialized statically, and not configurable.\r\n4. `Tasks` API is visible to user code. A user can kick off arbitrary background tasks using this API, which will get executed on the main thread pool of the SDK, un-regulated.\r\n\r\nIn order to address these limitations, we can consider the following changes:\r\n\r\n* Expose synchronous/blocking variants of public APIs where it makes sense (most notably at `FirebaseAuth`).\r\n\r\n```\r\nBlockingFirebaseAuth auth = FirebaseAuth.getBlockingInstance();\r\nString customToken = auth.createCustomToken(\"user1\");\r\n```\r\n\r\n* Make the thread pool and thread factory configurable via app options.\r\n* Hide or decommission the `Tasks` API. We can consider using the `ApiFutures` from Google Cloud Commons (this is similar to Guava's `ListenableFutures`) as a replacement.\r\n\r\n```\r\nFirebaseAuth auth = FirebaseAuth.getInstance();\r\nApiFuture<String> customTokenFuture = auth.createCustomToken(\"user1\");\r\n\r\n// The following should not be supported \r\n// Tasks.call(new Callable(){...}); \r\n```"}}
{"actor":{"display_login":"hiranya911"}}