{"action":"created","issue":{"url":"https://api.github.com/repos/nhachicha/SnappyDB/issues/52","labels_url":"https://api.github.com/repos/nhachicha/SnappyDB/issues/52/labels{/name}","comments_url":"https://api.github.com/repos/nhachicha/SnappyDB/issues/52/comments","events_url":"https://api.github.com/repos/nhachicha/SnappyDB/issues/52/events","html_url":"https://github.com/nhachicha/SnappyDB/issues/52","id":87613545,"number":52,"title":"Issues with persisting objects over multiple network calls.","user":{"login":"rajivenator","id":1876140,"avatar_url":"https://avatars.githubusercontent.com/u/1876140?v=3","gravatar_id":"","url":"https://api.github.com/users/rajivenator","html_url":"https://github.com/rajivenator","followers_url":"https://api.github.com/users/rajivenator/followers","following_url":"https://api.github.com/users/rajivenator/following{/other_user}","gists_url":"https://api.github.com/users/rajivenator/gists{/gist_id}","starred_url":"https://api.github.com/users/rajivenator/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rajivenator/subscriptions","organizations_url":"https://api.github.com/users/rajivenator/orgs","repos_url":"https://api.github.com/users/rajivenator/repos","events_url":"https://api.github.com/users/rajivenator/events{/privacy}","received_events_url":"https://api.github.com/users/rajivenator/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-06-12T05:29:35Z","updated_at":"2015-06-13T13:18:03Z","closed_at":null,"body":"Hi, I am a beginner on Android and I have been using SnappyDb for my project.\r\nI have a lot of network requests using retrofit. I am able to get the objects related to JSON passed over the network in my app.\r\nNow the issue is that upon receipt of the object i try to persist them, and they get persisted for few calls and later i start getting \"com.snappydb.SnappydbException: Your database is still open, please close it\" this error.\r\n\r\nIs there a simpler way to check whether a db is open or not, and also if there are any such inbuilt methods to handle these situations."},"comment":{"url":"https://api.github.com/repos/nhachicha/SnappyDB/issues/comments/111709757","html_url":"https://github.com/nhachicha/SnappyDB/issues/52#issuecomment-111709757","issue_url":"https://api.github.com/repos/nhachicha/SnappyDB/issues/52","id":111709757,"user":{"login":"nhachicha","id":1793238,"avatar_url":"https://avatars.githubusercontent.com/u/1793238?v=3","gravatar_id":"","url":"https://api.github.com/users/nhachicha","html_url":"https://github.com/nhachicha","followers_url":"https://api.github.com/users/nhachicha/followers","following_url":"https://api.github.com/users/nhachicha/following{/other_user}","gists_url":"https://api.github.com/users/nhachicha/gists{/gist_id}","starred_url":"https://api.github.com/users/nhachicha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nhachicha/subscriptions","organizations_url":"https://api.github.com/users/nhachicha/orgs","repos_url":"https://api.github.com/users/nhachicha/repos","events_url":"https://api.github.com/users/nhachicha/events{/privacy}","received_events_url":"https://api.github.com/users/nhachicha/received_events","type":"User","site_admin":false},"created_at":"2015-06-13T13:18:03Z","updated_at":"2015-06-13T13:18:03Z","body":"Hi @rajivenator since you're using Retrofit, I guess the real pb you're facing is concurrency.\r\nI doubt you're trying to write concurrently to your database which is not possible since the instance of `SnappyDB` *is not Thread safe*.\r\nWhat you need to do is synchronize your operations (by using intrinsic/private lock). you can also test if your db is open using `dbInstance.isOpen()`\r\n\r\nCheers,"}}