Closed 4gus71n closed 2 years ago
@4gus71n Did you find the solution ?
@afeozzz What I did so far was providing a single thread Scheduler from my App module. I didn't push a release version with that change yet and I didn't see any change on the log. So I don't know if its 100% fixed.
Super old issue however in 5.1 we added synchronized
keyword on the BaseDaoImpl.createOrUpdate()
and createIfNotExists()
methods. Hopefully that will protect against similar race conditions.
Hi,
I'm from a team of developers and we are currently using ORMlite to implement our database layer in our App. We are running on some issues because we have two different methods, from two different database interactors that are using the same DAO, those methods are wrapped on a rx.Observable, so they execute asynchronously. One of our database inteactors is call
FeedCache
and the other one is callSchedulesCache
. In some part of our code we are executing the following code:Each method implementation looks like this:
The thing is that internally in those *Sql methods we end up calling this DAO
getHelper().getEventDao().createOrUpdate(dbEventDTO);
and that causes this exception to be raised:If we avoid execute the line
mSchedulesCache.saveSchedule(someSchedule);
everything goes fine. The thing is that we want to be able to execute those two lines without problem. We know that the cause of this issue must be the rx.Observable's threads messing with the database transactions. Is there any solution to this? Maybe injecting the same thread for both rx.Observables? Has anyone experienced something like this?Update:
I tried something like this:
So the Dao object can be access by one object at the time and we avoid the issue, but what I'm getting now is this warning:
Seems to save the data in the database fine. Anyone know why is throwing this warning?