Debugging Event Handlers

There are a variety of options available to test event handlers.

See the event handler API documentation (Start menu > Attachmate Verastream > Host Integrator > Help > Event Handler API) for more information.

Debugging Event Objects

It is good practice to confirm that the event handler is returning the results you expect.

General Debugging Options

The Validator, available on the Debug menu, confirms that libraries associated with event handlers are up to date.

The Event Handler Console, also available from the Debug menu, displays the output that event handlers send to the Java system output stream.

You can modify the following properties in properties files:

See Event Handler Best Practices for detailed information on event handlers in general and specifically on limiting the use of output streams to ensure performance efficiency.

Remote Java debugging

If the debugging port on the Java virtual machine that hosts the script manager is enabled, you can use your Java IDE's remote debugging features to set breakpoints, step through code, and view runtime status. The debug port is opened by default in the Design Tool, but must be enabled in the configuration before startup (or restart) in the Session Server. You can review the debugging port setting for the Design Tool on the event handler settings Debugging tab; review a Session Server's assigned event handler debug port in the Administrative WebStation.

Event Handler Timeouts

You can disable event handler timeouts in both the Session Server and the Design Tool. When event handler timeouts are disabled, all timers used to calculate timeouts (for a single session) are suspended whenever that session has fired an event to the script manager. Once the script manager returns a response to the Design Tool or Session Server, the suspended timers will resume.

Testing event handler timeouts

Use these steps to test event handler timeouts.

  1. Place a breakpoint in the event handler code activated by an event.

  2. Leave event handler timeouts enabled.

  3. Set the event handler timeout and client timeouts to a value larger than the time expected for the event handler activity.

  4. Cause the event to fire and stop execution at the breakpoint.

  5. Click Cancel while the event is in progress to force a timeout exception to be sent to the event handler.

    When an event takes more than a half second to complete, a progress window with a Cancel button is displayed. This is the same dialog box displayed for tracking the progress of procedures and operations. In some cases, this dialog box may already be open when the event handling condition occurs.

  6. Begin single-stepping through the event handler code to determine how the event handler reacts to the timeout.