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

Bruno P. Kinoshita commented on LANG-1085:
------------------------------------------

Hi Oliver!

> I think this is a proof of concept that the interface we came up with is 
> sufficiently generic.

Hopefully :-) That's why I also linked some other issues in ASF JIRA. We can 
use them to test our design and see if it needs to be made more generic to fit 
other use cases.

>Maybe we can work-around this by using strategy classes associated with the 
>different states.

+1 would you be able to use the existing code and enhance it with the strategy 
pattern? Feel free to clone, create a new repo/gists, or let me know if you'd 
like to get full access over that repo.

>Does it make sense to have logic to close the circuit breaker automatically 
>when memory usage is decreasing again?

I thought about doing that too, but wasn't sure about it because the use case 
of ElasticSearch is a bit different. When you query ES, it looks at its 
existing circuit breakers to see if the result set is below some given 
threshold. If it is not, the circuit opens and the query fails (useful to avoid 
OutOfMemoryException, when well configured).

So the circuit breaker is related to the query result set size, and not to the 
system memory usage in ES. Maybe we could add some way to have the memory 
circuit breaker to return to closed when usage is decreasing, or create a new 
implementation for that.

> 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