今天定位了一个内存泄露的问题,错误如下:
Exception in thread"http-exec-24" java.lang.OutOfMemoryError: unable to create newnative thread
众所周知,内存泄露和内存溢出JVM都会抛出OutOfMemoryError异常。内存泄露是由于程序编码有缺陷,通过修改Java代码可以修复。内存溢出则是由于JVM运行时需要占用的内存大于JVM启动参数所设置的。
看下现有代码:
/***
* 测试线程池关闭。
* @authorjim
*
*/
public class ThreadPoolTest {
/**<