× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



James,

What does your main loop look like? Is it literally:

while (true)
{
(read contents of folder)
(check whether contents of folder have changed)
}

? With no delay in there? I would expect just slotting in a Thread.sleep
(30000); (if a 30 sec delay is acceptable) would reduce the CPU usage to 0%
during those 30 second wait periods?

Or if that doesn't help, on the SBMJOB command you could try running it
with a really low priority (say 95)?

Hope this helps,

Nigel Gay.




"James Perkins"
<jrperkinsjr@gmai
l.com> To
Sent by: "Java Programming on and around the
java400-l-bounces iSeries / AS400"
@midrange.com <java400-l@xxxxxxxxxxxx>
cc

21/08/2008 12:57 Subject
PM Never Ending Java Program


Please respond to
Java Programming
on and around the
iSeries / AS400
<java400-l@midran
ge.com>






Hello All,
I'm just curious to see how others might be handling this.

I want to run a Java program in a batch job probably that will never end.
It's a directory listener that will listen for file additions and removals
from the directory.

I have ran it interactively and it was using about 120% of the CPU. In
batch
it was around 11%.

Are any of you running never ending Java programs? Any suggestions on
optimizing it or a better way to run it?

--
Thanks in advance,
James R. Perkins
--
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/java400-l
or email: JAVA400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.




********************************************************************************
The information in this message is confidential and may be legally
privileged. It is intended solely for the addressee; access to this
email by anyone else is unauthorised.

If you are not the intended recipient: (1) you are kindly requested
to return a copy of this message to the sender indicating that you
have received it in error, and to destroy the received copy; and (2)
any disclosure or distribution of this message, as well as any action
taken or omitted to be taken in reliance on its content, is prohibited
and may be unlawful.
********************************************************************************

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.