Giter Club home page Giter Club logo

Comments (5)

SimenB avatar SimenB commented on May 27, 2024

If this is changed, I'd highly prefer an API that can compile-time checked.

As in, don't expose the current constructor, but have something like public static Unleash startPolling() in a UnleashBuilder or something like that. If that's not wanted, an IllegalStateException has to be thrown, defaulting to some other state is way more surprising and error-prone IMO.

Not sure if this is really needed though.

The way unleash is implemented now it is not really intuitive for the developer.

How so?

We see from time to time this ending up with memory leakage because the developer creates a new unleash instance per request handler.

Could all the clients use a static poller and metrics publisher so they all share that one instance instead? So you can instantiate multiple UnleashClients without worry

from unleash-client-java.

ivarconr avatar ivarconr commented on May 27, 2024

Could all the clients use a static poller and metrics publisher so they all share that one instance instead?

Unleash already uses just one static poller shared among all instances of unleash. This does not solve the memory leakage problem though, as they all register a callback.

The way unleash is implemented now it is not really intuitive for the developer.

It seems like developers does not realise that Unleash is a service, which will be running in the background, even after the thread creating it is terminated. Maybe we can do some magic around the initiating thread being terminated? Or unleash could detect if it is being instantiated thousands of times and give some kind of warning?

If this is changed, I'd highly prefer an API that can compile-time checked.

Yes, I agree, some kind of builder/factory is the way to go! But I still feel a bit reluctant to changing the API of Unleash. It will be confusing for people upgrading the client if they suddenly have to call a builder/factory.

from unleash-client-java.

SimenB avatar SimenB commented on May 27, 2024

The goal should be to make it harder/impossible to do the wrong thing without making it verbose to do the right thing.

Talked some offline with @theneva, any objection against using WeakReference?

from unleash-client-java.

ivarconr avatar ivarconr commented on May 27, 2024

Would be nice if that just works, have no personal experience using WeakReference in Java.

Care to make a PoC on using it?

from unleash-client-java.

ivarconr avatar ivarconr commented on May 27, 2024

closed via #67

from unleash-client-java.

Related Issues (20)

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.