Pausing Execution

There isn't a delivered way to pause the execution of PeopleCode. However, there are two alternatives that you can use:

  • The java.lang.Thread.sleep() Java Class method or;
  • The DBMS_LOCK.SLEEP() database procedure (Oracle only)

Using java.lang.Thread.sleep()

To use this approach, add the following line to your PeopleCode, passing a value in milliseconds which is the amount of time to sleep:

GetJavaClass("java.lang.Thread").sleep(1000);

The code above will sleep for 1000 milliseconds (1 second). Note that this approach uses up CPU cycles and has a performance hit on the application server. If you find this to be an issue, then the second approach may be better suited if you have an Oracle database.

Using DBMS_LOCK.SLEEP()

SQLExec("exec DBMS_LOCK.SLEEP(1)");

The code above will sleep for 1 second.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License