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

Diff of /CircuitBreaker/src/dk/thoerup/circuitbreaker/OpenState.java

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

revision 393 by torben, Mon Oct 5 19:44:40 2009 UTC revision 424 by torben, Thu Oct 8 20:39:39 2009 UTC
# Line 3  package dk.thoerup.curcuitbreaker; Line 3  package dk.thoerup.curcuitbreaker;
3  import java.util.concurrent.atomic.AtomicLong;  import java.util.concurrent.atomic.AtomicLong;
4    
5    
6  public class OpenState implements CircuitBreakerState {  public final class OpenState implements CircuitBreakerState {
7    
8          private AtomicLong tripTime = new AtomicLong(0);          final private AtomicLong tripTime = new AtomicLong(0);
9          private AtomicLong timeout = new AtomicLong(0);          final private AtomicLong timeout = new AtomicLong(0);
10                    
11          public void setTimeout(long timeout) {          public void setTimeout(long timeout) {
12                  this.timeout.set( timeout );                  this.timeout.set( timeout );
# Line 43  public class OpenState implements Circui Line 43  public class OpenState implements Circui
43          tripTime.set(now);          tripTime.set(now);
44      }      }
45    
46            public String getName() {
47                    return "Open";
48            }
49            
50            public long getTimeout() {
51                    return timeout.get();
52            }
53            
54            public long getElapsed() {
55            long now = System.currentTimeMillis();
56            long elapsed = now - tripTime.get();
57            return elapsed;
58            }
59    
60  }  }

Legend:
Removed from v.393  
changed lines
  Added in v.424

  ViewVC Help
Powered by ViewVC 1.1.20