THRIFT-2551 OutOfMemoryError "unable to create new native thread" kills serve thread

Github Pull Request: This closes #112

Patch: Fuud
This commit is contained in:
Roger Meier 2014-05-29 16:25:22 +02:00
parent 72268b78a3
commit 80a44f84fb

View File

@ -139,6 +139,16 @@ public class TThreadPoolServer extends TServer {
Thread.currentThread().interrupt();
break;
}
} catch(OutOfMemoryError ex) {
LOGGER.warn("ExecutorService throws OutOfMemoryError "+ ex.getMessage() + (++rejections) +
" times(s)", ex);
try {
TimeUnit.SECONDS.sleep(1);
} catch (InterruptedException e) {
LOGGER.warn("Interrupted while waiting to place client on executor queue.");
Thread.currentThread().interrupt();
break;
}
}
}
} catch (TTransportException ttx) {