Open topic with navigation
WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
public class Event
The Event class object includes event override methods that allow you to extend the class.
public virtual method onLock, boolean inout lock, n inout wait, n in rec, a in rfa, a proc mreturn false
Traps a “Record is locked” error (LOCKED) issued during a Select iteration. This method is called with the current lock and wait settings, as well as a copy of the record that was locked and its GRFA. If onLock() is not implemented, false is returned and a LOCKED error is generated.
A LOCK qualifier lock_spec value (see LOCK) or Q_NO_DELETE (which is a lock mode to use during a call to Select.Delete() to allow a retry without deleting the locked record). (n)
A WAIT qualifier wait_spec value. (See WAIT.) (n)
Returned with the record that was locked. (a)
Returned with the RFA location of the record. If this RFA will be used to re‑establish the record after the Select has completed, we recommend the file use static RFAs. (a)
To trap a LOCKED error during a Select iteration, you must implement your own event class that extends the Select.Event class and overrides the onLock() method. Returning false from your onLock() method (which occurs if it is not implemented) allows a LOCKED event to be caught by your onLock() method and then resumed as if the event were not caught. Conversely, implementing the method and simply returning true tells the Select iteration to retry the operation that caused the event.
In addition, by altering the lock and wait flags, you can control how the operation handles the retry. For example, by setting lock to Q_NO_LOCK and returning true, the Select iteration can resume by skipping the locked record. During a Select.Delete() call, you can use Q_NO_DELETE to skip the deletion of a locked record.