@Override public boolean insert(final E element) { final boolean offered = this.queue.offer(element); if (!offered) { final long tmpMissedRecords = this.numFailedInserts.incrementAndGet(); if (LOG.isWarnEnabled() && ((tmpMissedRecords % 1024) == 1)) { // warn upon the first failed element and upon all 1024th one LOG.warn("Queue is full, dropping records. Number of already dropped records: " + tmpMissedRecords); } } return true; }
public static void close(final Closeable closeable, final Log log) { try { closeable.close(); } catch (final IOException e) { if (log.isWarnEnabled()) { log.warn("Caught exception while closing '" + closeable.getClass() + "'.", e); } } } }
private void addToPatternEntryList(final String pattern) { if (pattern.length() == 0) { // ignore empty lines return; } try { switch (pattern.charAt(0)) { case '+': this.patternList.add(new PatternEntry(pattern.substring(1).trim(), true)); break; case '-': this.patternList.add(new PatternEntry(pattern.substring(1).trim(), false)); break; case '#': // ignore comment break; default: if (LOG.isWarnEnabled()) { LOG.warn("Each line should either start with '+', '-', or '#'. Ignoring: " + pattern); } break; } } catch (final InvalidPatternException ex) { LOG.error("'" + pattern.substring(1) + "' is not a valid pattern.", ex); } }
} else { if (LOG.isWarnEnabled()) { LOG.warn("No mapping file in directory '" + this.inputDir.getAbsolutePath() + "'");
} else { if (LOG.isWarnEnabled()) { LOG.warn("No mapping file in directory '" + this.inputDir.getAbsolutePath() + "'");
return; } catch (final IOException ex) { if (LOG.isWarnEnabled()) { LOG.warn("Error reading adaptive monitoring config file: " + this.configFilePathname, ex); if (LOG.isWarnEnabled()) { LOG.warn("Adaptive monitoring config file not found: " + this.configFilePathname);
break; default: if (LOG.isWarnEnabled()) { LOG.warn("Unexpected value for property '" + ConfigurationFactory.ADAPTIVE_MONITORING_BOUNDED_CACHE_BEHAVIOUR + "'. Using default value 0."); cacheSize = this.maxCacheSize; } else { if (LOG.isWarnEnabled()) { LOG.warn("Invalid value for property '" + ConfigurationFactory.ADAPTIVE_MONITORING_MAX_CACHE_SIZE + "'. Using default value 100.");
if (LOG.isWarnEnabled()) { LOG.warn("Unknown value '" + recordQueueInsertBehavior + "' for " + PREFIX + RECORD_QUEUE_INSERT_BEHAVIOR + "; using default value 0");