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

Diff of /miscJava/CircuitBreaker/src/main/java/dk/thoerup/circuitbreaker/CircuitBreaker.java

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

revision 396 by torben, Tue Oct 6 04:59:03 2009 UTC revision 397 by torben, Tue Oct 6 05:22:40 2009 UTC
# Line 105  public class CircuitBreaker{ Line 105  public class CircuitBreaker{
105          }          }
106      }      }
107            
108        
109      private CircuitBreakerState getState() {      private CircuitBreakerState getState() {
110          synchronized(this) {          synchronized(this) {
111                  return currentState;                  return currentState;
112          }          }
113      }      }
114        
115        public String getName() {
116            return name;
117        }
118        
119        public String getStateName() {
120            return getState().getName();
121        }
122        
123        public int getThreshold() {
124            return closed.getThreshold();
125        }
126        
127        public int getFailureCount() {
128            if (getState() == closed) {
129                    return closed.getFailureCount();
130            } else {
131                    return -1;
132            }
133        }
134        
135        public long getElapsed() {
136            if (getState() == open) {
137                    return open.getElapsed();
138            } else {
139                    return -1;
140            }
141        }
142    
143  }  }

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

  ViewVC Help
Powered by ViewVC 1.1.20