[ 
https://issues.apache.org/jira/browse/LANG-1085?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14566053#comment-14566053
 ] 

Oliver Heger commented on LANG-1085:
------------------------------------

Hi Bruno,

I had a look at your code. Great stuff! It is especially good to see that you 
managed to use the basic circuit breaker interface for different use cases 
(memory usage and timing conditions). I think this is a proof of concept that 
the interface we came up with is sufficiently generic.

Some remarks about details:
* When I wrote my original implementation I had complex if-then-else cascades 
related to the current state of the circuit breaker. I could significantly 
simplify the code by refactoring logic out into the State enumeration class. As 
State is now more generic in your model, you had to move this logic out of the 
class, and volia - here the if-then-else blocks are again! Maybe we can 
work-around this by using strategy classes associated with the different states.
* TimedCircuitBreaker is pretty straight-forward - which is a good thing. Does 
it make sense to have logic to close the circuit breaker automatically when 
memory usage is decreasing again?

> Add a circuit breaker implementation
> ------------------------------------
>
>                 Key: LANG-1085
>                 URL: https://issues.apache.org/jira/browse/LANG-1085
>             Project: Commons Lang
>          Issue Type: New Feature
>          Components: lang.concurrent.*
>            Reporter: Oliver Heger
>         Attachments: CircuitBreaker.java, CircuitBreakerTest.java
>
>
> A _circuit breaker_ is a useful component to protect an application against 
> unreliable services or load peaks. A simple implementation could be a good 
> fit for the concurrent package.
> A proposed implementation is attached. Feedback is welcome!



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to