/[projects]/CircuitBreaker/src/dk/thoerup/curcuitbreaker/CircuitBreaker.java
ViewVC logotype

Diff of /CircuitBreaker/src/dk/thoerup/curcuitbreaker/CircuitBreaker.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 394 by torben, Mon Oct 5 19:46:15 2009 UTC revision 396 by torben, Tue Oct 6 04:59:03 2009 UTC
# Line 5  import java.util.logging.Logger; Line 5  import java.util.logging.Logger;
5  /* Simple CircuitBreaker implementation - snipped from http://www.jroller.com/kenwdelong/entry/circuit_breaker_in_java  /* Simple CircuitBreaker implementation - snipped from http://www.jroller.com/kenwdelong/entry/circuit_breaker_in_java
6   *   *
7   *  example of how it can be used   *  example of how it can be used
8  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {  
9     private CircuitBreaker cb = new CircuitBreaker("test", 5, 10000);
10     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
11                  class TestInvocation implements CircuitInvocation {                  class TestInvocation implements CircuitInvocation {
12                          String url;                          String url;
13                          public TestInvocation(String url) {                          public TestInvocation(String url) {
# Line 78  public class CircuitBreaker{ Line 80  public class CircuitBreaker{
80            
81      public void tripBreaker() {      public void tripBreaker() {
82          synchronized(this) {          synchronized(this) {
                 currentState = open;  
83                  open.trip();                  open.trip();
84                    currentState = open;
85    
86                                    
87                  logger.warning("Circuitbreaker tripBreaker - " + name);                  logger.warning("Circuitbreaker tripBreaker - " + name);
88          }          }

Legend:
Removed from v.394  
changed lines
  Added in v.396

  ViewVC Help
Powered by ViewVC 1.1.20