--- CircuitBreaker/src/dk/thoerup/curcuitbreaker/web/ActionCommand.java 2009/10/08 07:21:46 418 +++ miscJava/CircuitBreaker/src/main/java/dk/thoerup/circuitbreaker/web/ActionCommand.java 2017/12/28 09:34:47 3212 @@ -1,4 +1,4 @@ -package dk.thoerup.curcuitbreaker.web; +package dk.thoerup.circuitbreaker.web; import java.io.IOException; import java.net.URLEncoder; @@ -6,9 +6,10 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import dk.thoerup.curcuitbreaker.AccountingCircuitBreaker; -import dk.thoerup.curcuitbreaker.CircuitBreaker; -import dk.thoerup.curcuitbreaker.CircuitBreakerManager; +import dk.thoerup.circuitbreaker.CircuitBreaker; +import dk.thoerup.circuitbreaker.CircuitBreakerManager; +import dk.thoerup.circuitbreaker.statistics.AccountingStatistics; +import dk.thoerup.circuitbreaker.statistics.LoggingStatistics; public class ActionCommand implements Command { @@ -22,7 +23,7 @@ String action = req.getParameter("action"); String breaker = req.getParameter("breaker"); - CircuitBreaker cb = CircuitBreakerManager.getManager().getCircuitBreaker(breaker); + CircuitBreaker cb = CircuitBreakerManager.getManager().getCircuitBreaker(breaker); if (readOnly == false) { if (action.equalsIgnoreCase("reset")) @@ -32,8 +33,13 @@ cb.tripBreaker(); if (action.equalsIgnoreCase("resetcounters")) { - AccountingCircuitBreaker acb = (AccountingCircuitBreaker) cb; - acb.resetCounters(); + AccountingStatistics stats = (AccountingStatistics) cb.getStatistics(); + stats.resetCounters(); + } + + if (action.equalsIgnoreCase("clearlog") ) { + LoggingStatistics stats = (LoggingStatistics) cb.getStatistics(); + stats.clearLog(); } }