{"action":"created","issue":{"url":"https://api.github.com/repos/androidannotations/androidannotations/issues/1909","repository_url":"https://api.github.com/repos/androidannotations/androidannotations","labels_url":"https://api.github.com/repos/androidannotations/androidannotations/issues/1909/labels{/name}","comments_url":"https://api.github.com/repos/androidannotations/androidannotations/issues/1909/comments","events_url":"https://api.github.com/repos/androidannotations/androidannotations/issues/1909/events","html_url":"https://github.com/androidannotations/androidannotations/issues/1909","id":193422900,"number":1909,"title":"Check whether a @Background task is running","user":{"login":"Goutte","id":592545,"avatar_url":"https://avatars.githubusercontent.com/u/592545?v=3","gravatar_id":"","url":"https://api.github.com/users/Goutte","html_url":"https://github.com/Goutte","followers_url":"https://api.github.com/users/Goutte/followers","following_url":"https://api.github.com/users/Goutte/following{/other_user}","gists_url":"https://api.github.com/users/Goutte/gists{/gist_id}","starred_url":"https://api.github.com/users/Goutte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Goutte/subscriptions","organizations_url":"https://api.github.com/users/Goutte/orgs","repos_url":"https://api.github.com/users/Goutte/repos","events_url":"https://api.github.com/users/Goutte/events{/privacy}","received_events_url":"https://api.github.com/users/Goutte/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2016-12-05T06:42:59Z","updated_at":"2016-12-11T00:43:18Z","closed_at":null,"body":"I can't find how to do this with AA. Is it even doable ?\r\n\r\nChecking either by `serial` or `id` is fine by me, even if it does not actually mean the same thing, as far as I understand.\r\n\r\nI found the `BackgroundExecutor.hasSerialRunning(String serial)` method, but it's private.\r\nI'm trying to hack around with `checkBgThread` and a custom `WrongThreadListener` but it feels overly complicated and anyhow I want to run this check from the UI thread so I'm not sure this'll work.\r\n\r\nI'm probably doing this wrong, I can't be the only one with this need ; I'll update the doc if there's a simple solution I've overlooked.\r\n\r\n---\r\n\r\nTo clarify, I want to check the state of a specific background task in response to user input (a click on a button) and in event listeners (I'm using the EventBus). It was rather easily doable with Asyncs, but I'm trimming the fat with the awesome annotations."},"comment":{"url":"https://api.github.com/repos/androidannotations/androidannotations/issues/comments/266252891","html_url":"https://github.com/androidannotations/androidannotations/issues/1909#issuecomment-266252891","issue_url":"https://api.github.com/repos/androidannotations/androidannotations/issues/1909","id":266252891,"user":{"login":"Goutte","id":592545,"avatar_url":"https://avatars.githubusercontent.com/u/592545?v=3","gravatar_id":"","url":"https://api.github.com/users/Goutte","html_url":"https://github.com/Goutte","followers_url":"https://api.github.com/users/Goutte/followers","following_url":"https://api.github.com/users/Goutte/following{/other_user}","gists_url":"https://api.github.com/users/Goutte/gists{/gist_id}","starred_url":"https://api.github.com/users/Goutte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Goutte/subscriptions","organizations_url":"https://api.github.com/users/Goutte/orgs","repos_url":"https://api.github.com/users/Goutte/repos","events_url":"https://api.github.com/users/Goutte/events{/privacy}","received_events_url":"https://api.github.com/users/Goutte/received_events","type":"User","site_admin":false},"created_at":"2016-12-11T00:43:18Z","updated_at":"2016-12-11T00:43:18Z","body":"I'm looking some more at the generated sources. Any method with `@UiThread` is wrapped in a `UiThreadExecutor.runTask()`. This suggests that this _wrapping_ is done in the background thread. Therefore, in the method annotated with the `@UiThread`, the background may or may not be still running, there's no way to be 100% sure. It probably stops quite fast, but that's still a race. And that's no good. Nope. No no no. Am I getting this right ?"}}
{"actor":{"display_login":"Goutte"}}