There's a more complete example here https://github.com/zsystems/java-samples/blob/master/MvsConsoleInteraction.java.

Using Object.wait()/notify() is a bit hairy. A more modern implementation would use Condition.await()/signal() but it's fine for this use case.

On 23/06/2022 12:16 pm, Andrew Rowley wrote:
On 23/06/2022 1:40 pm, Tony Harminc wrote:
[...]
          while (!stopped)
          {
              Thread.sleep(1000);
          }
      }
Does this actually always sleep for the entire time, or is it somehow
interrupted by the MODIFY command? In an ordinary MVS environment, one
would write a command handling subtask, and when the main (or a
worker) task waits for work, it waits on both the work ECB and the
command-has-been-issued one. Or a we-are-shutting-down one. In this
example it appears that the worker task/thread both waits for commands
and does the work (the report).

The main thread sleeps for the entire 1000 milliseconds.

The handleModify and handleStop methods are called on another thread from JZOS.

It is possible to interrupt waiting/sleeping threads, but that kind of inter-thread communication gets more complicated. I was just trying to illustrate the setup for receiving STOP and MODIFY commands.


----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to lists...@listserv.ua.edu with the message: INFO IBM-MAIN

Reply via email to