Yeah, that approach seems like it will help you keep a grip on your sanity.
On Fri, May 2, 2014 at 9:21 AM, Yaron Goland <[email protected]> wrote: > And that's why I send mails to the group. :) > > > Normally I wouldn't care about the change listeners because I don't ever use > them (we > ONLY talk over HTTP so nobody gets to use the manager object directly) but I > can see this being a problem for continuous replications which do need the > change listeners. > > > I suspect the only sane approach is to take advantage of TJWS's dual > listener support. It is able to listen to more than one port at once. > Although I'll probably have to write a custom adapter to get it to do what I > want. But that isn't brain surgery. > > > Thanks, > > > Yaron > > > ------------------------------ > *From:* [email protected] < > [email protected]> on behalf of Jens Alfke < > [email protected]> > *Sent:* Friday, May 02, 2014 8:36 AM > *To:* [email protected] > *Cc:* Wayne Carter; Traun Leyden > *Subject:* Re: Does Couchbase lite want to support multiple listeners > sharing the same underlying database file? > > > On May 2, 2014, at 8:20 AM, Yaron Goland <[email protected]> wrote: > > So today, in theory anyway, I should be able to set up two separate > listeners on the same box (Android or otherwise) and have both listeners > talk to the same database file without problem. SQLite certainly supports > this behavior. > > > This won’t *quite* work. The Document class wants to know when changes > are made to the database so it can update its internal state like > currentRevision. Internally, when multiple threads are using the same > database file, they post notifications so one Database instance can > discover that another one has changed documents. (This happens during > replication, for example.) But those notifications are within the process, > so if two processes have the same database open they won’t notify each > other. > > This wouldn’t be that hard to fix (assuming that Android has > interprocess notifications?) but it’s just never come up as something that > needed to be done. It’s a non-issue on iOS due to app sandboxing. > > But I've heard Jens mentioning that Couchbase Lite might be changing their > underlying database. > So I wanted to check how committed is Couchbase to continuing this > behavior? > > > ForestDB fundamentally has good concurrency support. (Better than > SQLite’s, in that a writer doesn’t block readers.) But I think at the > moment it doesn’t have any way to arbitrate multiple processes trying to > write to the database at the same time; they won’t corrupt the database, > it’s just that the last one to commit would probably overwrite the other’s > changes. I’ll ask the team if that’s so, and if they plan to add some kind > of file-locking to guard against that. (If not, it’s something CBL could > probably add on its own.) > > —Jens > > -- > You received this message because you are subscribed to the Google Groups > "Couchbase Mobile" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/mobile-couchbase/68E7AE8C-C607-4A42-A1B3-38D4F7F1D2E7%40couchbase.com<https://groups.google.com/d/msgid/mobile-couchbase/68E7AE8C-C607-4A42-A1B3-38D4F7F1D2E7%40couchbase.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "Couchbase Mobile" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/mobile-couchbase/1399047661645.80137%40microsoft.com<https://groups.google.com/d/msgid/mobile-couchbase/1399047661645.80137%40microsoft.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/CACSSHCEqe1%2BizaZ-%3DqhVP%3Dns_jnWATx5s%3D6HtduRzyjOXTOVWw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
