Giter Site home page Giter Site logo

Comments (9)

jhalterman avatar jhalterman commented on August 19, 2024

It's a good practice to mark classes as final unless they're specifically designed with inheritance in mind. In this case, I don't see a problem, though I do have to ask, why not just create an instance of RetryPolicy that handles the exceptions you want and copy it if needed?

RetryPolicy basePolicy = new RetryPolicy().retryOn(apacheHttpExceptions);

public RetryPolicy newPolicy() {
  return basePolicy.copy();
}

from failsafe.

MALPI avatar MALPI commented on August 19, 2024

Because I want to use it in other Classes as well and with inheritance it is Mord convenient.

Besides that I'd like to give Circuitbreakers additional properties in Order to be able to identify them for monitoring reasons.

from failsafe.

jhalterman avatar jhalterman commented on August 19, 2024

@MALPI Fair enough. Done!

I've been asked about having a CircuitBreaker registry or some sort of named tracking for CircuitBreakers, but for now I think that's best left to users to track circuit breakers however they want, via a Map or DI framework or whatever works best for them. And rather than adding a name to circuit breakers, that's how I would do it - by tracking them externally:

class CircuitBreakerRegistry {
  ConcurrentMap<String, CircuitBreaker> breakers = new ConcurrentHashMap<>();

  public CircuitBreaker breakerFor(String name) {
    return breakers.computeIfAbsent(key, k -> new CircuitBreaker().....);
  }
}

But whatever works for you!

from failsafe.

MALPI avatar MALPI commented on August 19, 2024

Thanks a lot for your Quick response and your input! Really like failsafe so far!

from failsafe.

jhalterman avatar jhalterman commented on August 19, 2024

@MALPI Thanks. If you like it, please spread the word :)

from failsafe.

MALPI avatar MALPI commented on August 19, 2024

Did so ;-) See twitter... will promoted it also in the company. ;-)

from failsafe.

MALPI avatar MALPI commented on August 19, 2024

Can you release a new version for that?

from failsafe.

jhalterman avatar jhalterman commented on August 19, 2024

I have some other changes waiting to go in before a release, but hopefully after this weekend.

from failsafe.

jhalterman avatar jhalterman commented on August 19, 2024

Released

from failsafe.

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.