couchbaselabs / TouchDB-Android

CouchDB-compatible mobile database; Android version
239 stars 60 forks source link

CouchbaseViewListAdapter followChanges=true blocks other AsyncTasks #71

Closed schmidek closed 11 years ago

schmidek commented 12 years ago

Created an issue in ektorp android - https://github.com/helun/Ektorp/issues/88

AsyncTasks should not be used for long running tasks.

gaara87 commented 12 years ago

Aha, so if asynctasks should not be used for long running task what should be used to execute them?

I'm running 3 push replications and 2 pull replications in 5 different async tasks and i found the followChanges=true to not work. What is the work around for it? Hopefully the work around will be outside the actual issue fix so that we can continue using the application code even after updates and code fixes.

schmidek commented 12 years ago

As a workaround you may be able to use executeOnExecutor with THREAD_POOL_EXECUTOR or some other executor for all other asynctasks but it's far from ideal.

From developer documentation: "If you need to keep threads running for long periods of time, it is highly recommended you use the various APIs provided by the java.util.concurrent pacakge such as Executor, ThreadPoolExecutor and FutureTask."

tleyden commented 11 years ago

Update on this:

tleyden commented 11 years ago

Still pending TODO:

sallespromanager commented 11 years ago

hi,

i am not sure i know the steps to to that. Do you have any examples in hand ?

(1) Create a new Ektorp package that contains the AsyncTask workaround - as you have been working on this, can you do this last mile ?

by the way, is this a MUST to use Android Studio for this ? i have been using Eclipse and it seems Android Studio is in preview.

Can we use Eclipse instead, what would be necessary to take care in this case.

(2) Rebuild the CBLite artifacts and post to maven.hq.couchbase.com repository

that i have no idea at all.

tleyden commented 11 years ago

Yep, I'm working on the new Ektorp package and cblite artifacts.

You should be able to use Eclipse for your own project(s) just fine.

tleyden commented 11 years ago

Fixed