Thursday 3 November 2016

Using Java's SLEEP in Application Engine

Let's say you scheduled several nVision instances using your AE and you want to send an email right after everything ran to Success.

How do you force your AE to wait?

You can use this piece of code.

Repeat
   &RunningCount = 0;
   SQLExec("SELECT COUNT(*) FROM PSPRCSRQST WHERE PRCSINSTANCE IN (Figure out a subselect that will fetch your nVision instance numbers) AND RUNSTATUS IN (5, 6, 7)", &sProcessInstance, &RunningCount);
   
   If &RunningCount > 0 Then
      try
         &Pause = GetJavaClass("java.lang.Thread").sleep(600000);
         &Pause = Null;
      catch Exception &NoProblem1
         &Pause = Null;
      end-try;
   End-If;
Until &RunningCount = 0;

RUNSTATUS 5, 6, and 7 translates to Queued, Initiated and Processing respectively.

Sleep(600000) is 10 minutes because the value is in milliseconds.

4 comments:

  1. Thankyou for this wondrous post, I am happy I watched this site on yippee.
    BestSleepApneaTreat.com

    ReplyDelete
  2. Thank you very much for this useful article. I like it. Sleep Calculator

    ReplyDelete
  3. Thank you very much for this useful article. I like it. Sleep Calculator

    ReplyDelete
  4. Along with the support it offers, a memory mattress differs from standard mattress foams in that the open cell design allows air to pass through the material freely, which helps keep the mattress and the person using it cool and prevents excessive sweating. fleet mattress

    ReplyDelete