avoid spamming logs
@@ -507,6 +507,7 @@ public class XMLReaderUtils implements Serializable {
private static PoolDOMBuilder acquireDOMBuilder()
throws TikaException {
int waiting = 0;
+ long lastWarn = -1;
while (true) {
PoolDOMBuilder builder = null;
DOM_READ_WRITE_LOCK.readLock().lock();
@@ -520,8 +521,12 @@ public class XMLReaderUtils implements Serializable {
if (builder != null) {
return builder;
}
+ if (lastWarn < 0 || System.currentTimeMillis() - lastWarn > 1000) {
+ //avoid spamming logs
LOG.warn("Contention waiting for a DOMParser. " +
"Consider increasing the XMLReaderUtils.POOL_SIZE");
+ lastWarn = System.currentTimeMillis();
+ }
waiting++;
if (waiting > 3000) {
@@ -576,6 +581,7 @@ public class XMLReaderUtils implements Serializable {
private static PoolSAXParser acquireSAXParser()
throws TikaException {
int waiting = 0;
+ long lastWarn = -1;
while (true) {
PoolSAXParser parser = null;
SAX_READ_WRITE_LOCK.readLock().lock();
@@ -589,8 +595,12 @@ public class XMLReaderUtils implements Serializable {
if (parser != null) {
return parser;
}
+ if (lastWarn < 0 || System.currentTimeMillis() - lastWarn > 1000) {
+ //avoid spamming logs
LOG.warn("Contention waiting for a SAXParser. " +
"Consider increasing the XMLReaderUtils.POOL_SIZE");
+ lastWarn = System.currentTimeMillis();
+ }
waiting++;
if (waiting > 3000) {
//freshen the pool. Something went very wrong...
