{"action":"created","issue":{"url":"https://api.github.com/repos/realm/realm-java/issues/1584","labels_url":"https://api.github.com/repos/realm/realm-java/issues/1584/labels{/name}","comments_url":"https://api.github.com/repos/realm/realm-java/issues/1584/comments","events_url":"https://api.github.com/repos/realm/realm-java/issues/1584/events","html_url":"https://github.com/realm/realm-java/pull/1584","id":110963273,"number":1584,"title":"Missing realm check in some functions","user":{"login":"beeender","id":449296,"avatar_url":"https://avatars.githubusercontent.com/u/449296?v=3","gravatar_id":"","url":"https://api.github.com/users/beeender","html_url":"https://github.com/beeender","followers_url":"https://api.github.com/users/beeender/followers","following_url":"https://api.github.com/users/beeender/following{/other_user}","gists_url":"https://api.github.com/users/beeender/gists{/gist_id}","starred_url":"https://api.github.com/users/beeender/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beeender/subscriptions","organizations_url":"https://api.github.com/users/beeender/orgs","repos_url":"https://api.github.com/users/beeender/repos","events_url":"https://api.github.com/users/beeender/events{/privacy}","received_events_url":"https://api.github.com/users/beeender/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/realm/realm-java/labels/Review","name":"Review","color":"ededed"}],"state":"open","locked":false,"assignee":{"login":"beeender","id":449296,"avatar_url":"https://avatars.githubusercontent.com/u/449296?v=3","gravatar_id":"","url":"https://api.github.com/users/beeender","html_url":"https://github.com/beeender","followers_url":"https://api.github.com/users/beeender/followers","following_url":"https://api.github.com/users/beeender/following{/other_user}","gists_url":"https://api.github.com/users/beeender/gists{/gist_id}","starred_url":"https://api.github.com/users/beeender/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beeender/subscriptions","organizations_url":"https://api.github.com/users/beeender/orgs","repos_url":"https://api.github.com/users/beeender/repos","events_url":"https://api.github.com/users/beeender/events{/privacy}","received_events_url":"https://api.github.com/users/beeender/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2015-10-12T12:22:25Z","updated_at":"2015-10-12T13:33:30Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/realm/realm-java/pulls/1584","html_url":"https://github.com/realm/realm-java/pull/1584","diff_url":"https://github.com/realm/realm-java/pull/1584.diff","patch_url":"https://github.com/realm/realm-java/pull/1584.patch"},"body":"* Generate realm check for getter and setter of RealmObject and RealmList.\r\n* Add realm check in RealmObject.removeFromRealm\r\n* Add realm check in RealmResults's remove, removeLast, clear methods\r\n* Add test cases\r\n* Minor warning fix\r\n\r\nMaybe related with #1554 ?"},"comment":{"url":"https://api.github.com/repos/realm/realm-java/issues/comments/147401653","html_url":"https://github.com/realm/realm-java/pull/1584#issuecomment-147401653","issue_url":"https://api.github.com/repos/realm/realm-java/issues/1584","id":147401653,"user":{"login":"beeender","id":449296,"avatar_url":"https://avatars.githubusercontent.com/u/449296?v=3","gravatar_id":"","url":"https://api.github.com/users/beeender","html_url":"https://github.com/beeender","followers_url":"https://api.github.com/users/beeender/followers","following_url":"https://api.github.com/users/beeender/following{/other_user}","gists_url":"https://api.github.com/users/beeender/gists{/gist_id}","starred_url":"https://api.github.com/users/beeender/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/beeender/subscriptions","organizations_url":"https://api.github.com/users/beeender/orgs","repos_url":"https://api.github.com/users/beeender/repos","events_url":"https://api.github.com/users/beeender/events{/privacy}","received_events_url":"https://api.github.com/users/beeender/received_events","type":"User","site_admin":false},"created_at":"2015-10-12T13:33:30Z","updated_at":"2015-10-12T13:33:30Z","body":"`checkIfValid` is relatively fast, most time consuming part is the `Thread.currentThread()` in there which leads to a jni call into bionic.\r\n\r\nFor now, since we are checking everywhere to make sure user won't use them in different thread, there is no reason to not check them in those places.\r\n\r\nFor the future, checking the thread in the jni code or even in the core would be a good idea. That could reduce the jni calls to accelerate a lot."}}