So far, it looks like using Singleton for Manager and just always calling
"getDatabase()" works.  I suspect that Database expects to have one
instance per thread, and the Manager takes care of that.

Regarding your comments on view compatibility, are you talking about
JavaScript-based views?  I thought that .NET-based and Android-based views
were compatible as of release 1.0.4.

On Thu, May 7, 2015 at 8:11 AM, Ken Courville <[email protected]> wrote:

> Should it be save to have one Singleton instance of Manager and one
> singleton instance of Database-per-database file?
>
> I'm battling this error at current:
> java.lang.IllegalStateException: attempt to re-open an already-closed
> object: SQLiteDatabase:
>
> On Wed, May 6, 2015 at 11:24 AM, Hideki Itakura <[email protected]>
> wrote:
>
>> Hi Ken,
>>
>> We recommends one Manager per an application. CBL supports multiple
>> databases per a Manager.
>>
>> > All of the examples I've run across appear to run on the UI thread.
>> I'm confused on the documentation.  I see this: "Android, Java It is safe
>> to call Couchbase Lite from multiple threads on the Android / Java
>> platform. If you find any thread safety related issues, please report a
>> bug."
>>
>> I believe it tries to say Database instance is thread safe. For example,
>> pull replication is run in another thread beside main/UI thread, UI thread
>> (add/update/delete document) and replicator thread (also add/update/delete
>> document) can access same database.
>>
>> > Also, last I checked, JavaScript-based views are not compatible between
>> Android and.NET CBL implementations.
>>
>> This is not because of JavaScript-based view. Current version of CBL
>> Android and .NET has incompatible for views table. We need to address this.
>>
>> Thanks!
>> Hideki
>>
>> On Tuesday, May 5, 2015 at 3:38:46 PM UTC-7, Ken Courville wrote:
>>>
>>> Howdy,
>>>
>>> First, I'm having a hard time logging into forums.couchbase.com.  Keep
>>> receiving "Sorry, there was an error authorizing your account. Perhaps you
>>> did not approve authorization?"  Otherwise, I'd post there.
>>>
>>> My question this time is: for Android CBL, should I be using one Manager
>>> per thread and one Database instance per database file per thread?
>>>
>>> All of the examples I've run across appear to run on the UI thread.  I'm
>>> confused on the documentation.  I see this: "Android, Java It is safe to
>>> call Couchbase Lite from multiple threads on the Android / Java platform.
>>> If you find any thread safety related issues, please report a bug."
>>>
>>> Do you have an example using multiple threads and maybe multiple
>>> databases?
>>>
>>> Here's our scenario:
>>> Our applications are primarily Cordova-based.  Due to performance
>>> requirements and amount of data we're working with (100K+ documents), we're
>>> unable to effectively use JavaScript-based views.  Also, last I checked,
>>> JavaScript-based views are not compatible between Android and.NET CBL
>>> implementations.  Is this still the case?  One solution we're looking into
>>> is generating the initial data (which changes daily) and indexes on a beefy
>>> server using .NET CBL and then downloading the initial .cblite file
>>> directly to the device.
>>>
>>> For the moment, we're using Cordova plugins to wrap CBL-based processes.
>>> Some processes take a few seconds, so we have to run them on a background
>>> thread.  And, outside of the Cordova plugins, there are background
>>> processes to manage synchronization with the remote server that also
>>> interact with the CBL databases.
>>>
>>> On the plus side, pulling from the CBL master branch has lowered our
>>> indexing times from 5 minutes per index to 30 seconds.  Thanks for that!
>>>
>>>  --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "Couchbase Mobile" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/mobile-couchbase/9ry5Cv5xkLg/unsubscribe
>> .
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/mobile-couchbase/bc96e0d0-74b6-4f57-8bf8-3e34b15d6fce%40googlegroups.com
>> <https://groups.google.com/d/msgid/mobile-couchbase/bc96e0d0-74b6-4f57-8bf8-3e34b15d6fce%40googlegroups.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/CAPMdqEDV65K6TiORYsZ2kQSV-KBv7zpU%3DMX_6yHRawRmDPu67g%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to