Giter Site home page Giter Site logo

Comments (7)

roman-mazur avatar roman-mazur commented on July 17, 2024

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.

almozavr avatar almozavr commented on July 17, 2024

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.

almozavr avatar almozavr commented on July 17, 2024

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.

roman-mazur avatar roman-mazur commented on July 17, 2024

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?

from goro.

almozavr avatar almozavr commented on July 17, 2024

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.

roman-mazur avatar roman-mazur commented on July 17, 2024

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.

almozavr avatar almozavr commented on July 17, 2024

@roman-mazur LGTM, thanks!

from goro.

Related Issues (7)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.