Comments (7)
Both schedule
and onServiceConnected
bodies are supposed to be synchronized using lock
... Hence, it's not really obvious for me why this does not work. I will try to reproduce.
from goro.
Yes, but it doesn't save you, because client calls bindOneshot
(which starts onServiceConnected
in main thread) and only then calls schedule
.
Possible api-friendly solution could be bindOneshot
changes:
@Override
public <T> ObservableFuture<T> bindOneshot(String queueName, Callable<T> task) {
synchronized (lock) {
oneshot = true;
}
ObservableFuture<T> future = schedule(queueName, task);
GoroService.bind(context, BoundGoroImpl.this);
return future;
}
from goro.
I've tried ↑ but saw it breaks the flaw of wrapping BoundGoro
with decorators like RxGoro
. So it's not the way. Another solution comes to my mind is to delegate unbinding from onServiceConnected
to some another place or, check if there is no pending jobs scheduled and make double check for unbind from schedule
call.
from goro.
Ah, now I see the problem... onServiceConnected
is invoked before schedule
, and in case of bindOneshot
we unbind from the service as soon as onServiceConnected
completes. Hence, postponed
list is never processed.
I'm thinking about making a separate Goro
implementation that will bind to the service if schedule
is invoked and unbind as soon as current work is delegated.
So, in your case, bindOneShot
will not be called at all (and we'll deprecate this method). Binding will be performed on every schedule
if it's required.
And there will be 2 implementations for Goro
that communicates with a service:
- current
BoundGoro
with explicit control allowing to adjustbind()
/unbind
with another component lifecycle Goro.oneshot()
without no extra methods beyondGoro
interface that will do binding on demand and unbind asap.
Opinions?
from goro.
Sounds good, +1.
On Mon, Jul 13, 2015, 4:20 PM Roman Mazur [email protected] wrote:
Ah, now I see the problem... onServiceConnected is invoked before schedule,
and in case of bindOneshot we unbind from the service as soon as
onServiceConnected completes. Hence, postponed list is never processed.I'm thinking about making a separate Goro implementation that will bind
to the service if schedule is invoked and unbind as soon as current work
is delegated.
So, in your case, bindOneShot will not be called at all (and we'll
deprecate this method). Binding will be performed on every schedule if
it's required.
And there will be 2 implementations for Goro that communicates with a
service:
- current BoundGoro with explicit control allowing to adjust bind()/
unbind with another component lifecycle- Goro.oneshot() without no extra methods beyond Goro interface that
will do binding on demand and unbind asap.Opinions?
—
Reply to this email directly or view it on GitHub
#4 (comment).
from goro.
Although we have a few thing to finish before 3.0 release, version 3.0.0-RC1 will be in Maven Central soon (it's already released, waiting for the sync). Please let me know how it works for you, if you get some time.
from goro.
@roman-mazur LGTM, thanks!
from goro.
Related Issues (7)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goro.