This was more difficult than I thought, or perhaps I was just dense yesterday afternoon, but I did slog through it and have a working set of snippets. Two classes, a monitor class implementing Runnable and a test class with main() method which implements PropertyChangeListener.

The monitor has to have its own independent connection to the AS400 so it gets a different QZRCSRVS than the one ProgramCall will run it. Otherwise, when ProgramCall goes into MSGW the monitor thread hangs.

If anyone wants to looks send me an e-mail. I request that you comment on the code and share any suggestions for improving it.

Bill Blalock

-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx] On Behalf Of Thorbjørn Ravn Andersen
Sent: Thursday, June 19, 2008 4:04 PM
To: Java Programming on and around the iSeries / AS400
Subject: Re: Can "ProgramCall going in MSGW" be detected?

Blalock, Bill skrev den 19-06-2008 21:20:
I think you would have to create a thread to monitor the job but it wouldn't be too difficult, and the thread could fire PropertyChangeEvents to monitor/listen for. Would this do what you need?

ProgramCall.getServerJob() returns the Job object which will execute the ProgramCall.run().

So if the program called by ProgramCall goes into message wait, the server job will be in message wait, right?

Put PropertyChangeSupport into the thread you are considering building. Put a shutdown() method in it. Instantiate the thread with the Job object returned by ProgramCall.getServerJob().

run() method of thread periodically checks the status of the Job passed to it when initiated. If status of job is MSGW it fires a PropertyChangeEvent.

After ProgramCall.run() returns call the shutdown method of the thread. If listener get MSGW event call the shutdown method of the thread.

Would that do it?

This is very close to what I would do, so it sounds like a reasonable
approach.

I was just hoping for some notification mechanism, but it appears not to
be or BVS would not have a product (which I'll keep in mind, but goes
outside my domain).

Thanks for all responses.


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-2020 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].