enableTransTraceCallback(callbackMethod: Method; callbackReceiver: Object; enable: Boolean);
The enableTransTraceCallback method of the Process class registers or unregisters a specified method and receiver for callback just prior to a transaction for the receiving process being committed. The receiving Process instance for the enableTransTraceCallback method must be the current process.
The callbackMethod parameter specifies the method to be invoked. The callbackReceiver parameter specifies the object to be used as the receiver of the invoked method. If the enable parameter is set to true, the callback is registered; if it is false, the callback is unregistered.
The callback method must have no parameters and no return type. It is invoked only if transaction tracing has been activated for the process by calling the startTransactionTrace method.
The enableTransTraceCallback method can be called multiple times to register additional method callbacks when a transaction commits. Calling the enableTransTraceCallback with a method and receiver combination that has been previously registered is ignored.
Methods are invoked in reverse order of when they were registered; that is, the most recently registered are invoked first.
The invoked method should not attempt to commit the transaction. Doing so causes repeated invocations of the method leading eventually to a kernel stack overflow.
Similarly, the invoked method should not abort the current transaction. Doing so raises an exception after the method returns and an attempt to commit the transaction is made.
If an exception occurs within an invoked method and is not dealt with by an exception handler, the transaction is not committed.
The following code fragment specifies that when a transaction for the current process commits, a method AnyClass class commitCallback is to be called for the receiver inst, which is of type AnyClass.
process.enableTransTraceCallback(AnyClass::commitCallback, inst, true);