Source:
<code>void runUntilCanceled() throws InterruptedException { ExponentialBackOff backoffTracker = null; while (!isCanceled()) { if (Thread.interrupted()) { throw new InterruptedException(); } Collection<Metric> metrics = metricsQueue.poll(batchSize, maxIdleTime); log.debug("Back from polling metricsQueue. metrics.size = {}", null == metrics ? "null" : metrics.size()); log.debug("Checking for shutdown. lastWorkTime = {}; maxIdleTime = {}; sum = {}; currentTime ={}", lastWorkTime, maxIdleTime, lastWorkTime+maxIdleTime, System.currentTimeMillis()); if (metrics.isEmpty() && lastWorkTime > 0 && maxIdleTime > 0 && System.currentTimeMillis() > lastWorkTime + maxIdleTime) { log.info("Shutting down writer due to dearth of work"); break; } if (metrics.isEmpty()) { log.debug("No work to do, so checking again."); continue; } if (backoffTracker == null) { backoffTracker = createExponentialBackOff(); } try { processBatch(metrics); backoffTracker.reset(); } catch (NoSuchElementException e) { long backOff = this.minBackOff; try { backOff = backoffTracker.nextBackOffMillis(); } catch (IOException e1) { log.debug("caught IOException backing off tracker - should go to default backOff."); } if (ExponentialBackOff.STOP == backOff) { backOff = backoffTracker.getMaxIntervalMillis(); log.warn("Error getting OpenTsdbClient after ms: {}", backoffTracker.getElapsedTimeMillis(), e.getMessage()); } log.debug("Connection back off, sleeping ms", backOff); Thread.sleep(backOff); <START> } catch (Exception e) { <END> log.error("Caught exception processing batch or backing off tracker.", e); } } log.debug("work canceled."); }</code><technical_language>catch bare exception</technical_language>

Target:
void runUntilCanceled() throws InterruptedException { ExponentialBackOff backoffTracker = null; while (!isCanceled()) { if (Thread.interrupted()) { throw new InterruptedException(); } Collection<Metric> metrics = metricsQueue.poll(batchSize, maxIdleTime); log.debug("Back from polling metricsQueue. metrics.size = {}", null == metrics ? "null" : metrics.size()); log.debug("Checking for shutdown. lastWorkTime = {}; maxIdleTime = {}; sum = {}; currentTime ={}", lastWorkTime, maxIdleTime, lastWorkTime+maxIdleTime, System.currentTimeMillis()); if (metrics.isEmpty() && lastWorkTime > 0 && maxIdleTime > 0 && System.currentTimeMillis() > lastWorkTime + maxIdleTime) { log.info("Shutting down writer due to dearth of work"); break; } if (metrics.isEmpty()) { log.debug("No work to do, so checking again."); continue; } if (backoffTracker == null) { backoffTracker = createExponentialBackOff(); } try { processBatch(metrics); backoffTracker.reset(); } catch (NoSuchElementException e) { long backOff = this.minBackOff; try { backOff = backoffTracker.nextBackOffMillis(); } catch (IOException e1) { log.debug("caught IOException backing off tracker - should go to default backOff."); } if (ExponentialBackOff.STOP == backOff) { backOff = backoffTracker.getMaxIntervalMillis(); log.warn("Error getting OpenTsdbClient after ms: {}", backoffTracker.getElapsedTimeMillis(), e.getMessage()); } log.debug("Connection back off, sleeping ms", backOff); Thread.sleep(backOff); } } log.debug("work canceled."); }