@Override public boolean isAvailable() { return delegate.isAvailable(); }
@Override public synchronized boolean clearError() { if (delegate.isAvailable()) { count = 0; // Just reset the error count return true; } else { // Count the successful attempts if (count++ == successCount) { return delegate.clearError(); } return false; } } }
@Override public synchronized boolean handleError() { if (delegate.isAvailable()) { final long time = System.currentTimeMillis(); // If the timeout is reached reset the error count if (time >= timeout) { count = 1; timeout = time + interval; } else { if (count++ == 1) { timeout = time + interval; } } if (count >= errorCount) { return delegate.handleError(); } return true; } else { count = 0; // if in error reset the successful count return false; } }
@Override public boolean isAvailable() { return delegate.isAvailable(); }
@Override public boolean isAvailable() { return delegate.isAvailable(); }
@Override public synchronized boolean clearError() { if (delegate.isAvailable()) { count = 0; // Just reset the error count return true; } else { // Count the successful attempts if (count++ == successCount) { return delegate.clearError(); } return false; } } }
@Override public synchronized boolean clearError() { if (delegate.isAvailable()) { count = 0; // Just reset the error count return true; } else { // Count the successful attempts if (count++ == successCount) { return delegate.clearError(); } return false; } } }
@Override public synchronized boolean handleError() { if (delegate.isAvailable()) { final long time = System.currentTimeMillis(); // If the timeout is reached reset the error count if (time >= timeout) { count = 1; timeout = time + interval; } else { if (count++ == 1) { timeout = time + interval; } } if (count >= errorCount) { return delegate.handleError(); } return true; } else { count = 0; // if in error reset the successful count return false; } }
@Override public synchronized boolean handleError() { if (delegate.isAvailable()) { final long time = System.currentTimeMillis(); // If the timeout is reached reset the error count if (time >= timeout) { count = 1; timeout = time + interval; } else { if (count++ == 1) { timeout = time + interval; } } if (count >= errorCount) { return delegate.handleError(); } return true; } else { count = 0; // if in error reset the successful count return false; } }