Controlling maximum Java standalone running in Linux

Posted by Gnanam on Stack Overflow See other posts from Stack Overflow or by Gnanam
Published on 2010-03-26T11:32:36Z Indexed on 2010/03/26 11:53 UTC
Read the original article Hit count: 358

Hi,

We've developed a Java standalone program. We've configured in our Linux (RedHat ES 4) cron schedule to execute this Java standalone every 10 minutes. Each standalone may sometime take more than 1 hour to complete, or sometime it may complete even within 5 minutes.

My problem/solution I'm looking for is, the number of Java standalones executing at any time should not exceed, for example, 5 threads. So, for example, before even a Java standalone/thread starts, if there are already 5 threads running, then this thread should not be started; otherwise this would indirectly start creating OutOfMemoryError problems. How do I control this? I would also like to make this 5 thread as configurable.

Other Information:
I've also configured -Xms and -Xmx heap size settings.

Is there any tool/mechanism by which we can control this?

I also heard about Java Service Wrapper. What is this all about?

© Stack Overflow or respective owner

Related posts about java

Related posts about threads