H
Hugo
Hi:
I have a three servlet classes in a Tomcat where I use the
ExetorServices to create a thread pool. The thread pool is used to
execute tasks so that the main thread does not slow down.
Problem: Tomcat crashes with an out of memory error:
"<snip>java.lang.OutOfMemoryError: unable to create new native thread)
executing org.apache.tomcat.util.net.TcpWorkerThread</snip>"
From looking at the logs, each time a servlet was called a new thread
was created. I am guessing that the Tomcat ran until the process ran
out of threads. I thought that the maximum number of threads that can
be created by the thread pool will be listed by the
newFixedThreadPool() method.
Sample of the code is below, can anyone help me out on where I have
gone wrong?
Public Class Foo extends HTTPServlet
{
ExecutorService pool = Executors.newFixedThreadPool(1000);
public void doGet{
//web form
}
public void doPost{
pool.execute(bar);
}
}
I have a three servlet classes in a Tomcat where I use the
ExetorServices to create a thread pool. The thread pool is used to
execute tasks so that the main thread does not slow down.
Problem: Tomcat crashes with an out of memory error:
"<snip>java.lang.OutOfMemoryError: unable to create new native thread)
executing org.apache.tomcat.util.net.TcpWorkerThread</snip>"
From looking at the logs, each time a servlet was called a new thread
was created. I am guessing that the Tomcat ran until the process ran
out of threads. I thought that the maximum number of threads that can
be created by the thread pool will be listed by the
newFixedThreadPool() method.
Sample of the code is below, can anyone help me out on where I have
gone wrong?
Public Class Foo extends HTTPServlet
{
ExecutorService pool = Executors.newFixedThreadPool(1000);
public void doGet{
//web form
}
public void doPost{
pool.execute(bar);
}
}