XFPL_REGCLEANUP

Register a cleanup method

WTSupported in traditional Synergy on Windows

 

USupported on UNIX
VSupported on OpenVMS
xcall XFPL_REGCLEANUP(methodID)

methodID

The method ID (as entered in the SMC) of the cleanup method to run. The method ID is case sensitive. (a)

XFPL_REGCLEANUP registers a cleanup method that will be run automatically on the server when xfServerPlus unexpectedly loses socket communication with the client. On OpenVMS, the cleanup method also runs when communication with the rsynd process is lost. The cleanup method is called by xfServerPlus after the remote execution server has timed out. You can set a time-out value for xfServerPlus with SET_XFPL_TIMEOUT.

This routine can be used with any xfNetLink client following the steps in To use XFPL_REGCLEANUP below. If you have an xfNetLink Java or xfNetLink .NET client and are using the pooling support methods, XFPL_REGCLEANUP and the corresponding cleanup method work differently; see To use XFPL_REGCLEANUP with the pooling support methods.

The default SMC is preloaded with an entry for XFPL_REGCLEANUP. If this entry is missing, you can import it from the defaultsmc.xml file. See Importing and exporting methods.

To use XFPL_REGCLEANUP

Follow these instructions to use XFPL_REGCLEANUP when you are using a Synergy client or are not using the pooling support methods with a Java or .NET client.

xfServerPlus calls the cleanup method registered by XFPL_REGCLEANUP only when there is a failure that causes socket communication to be lost. xfServerPlus does not call this cleanup method when a session is ended in the normal manner. If you want to perform any cleanup tasks during normal session shutdown, you will need to explicitly call either this cleanup method or a separate cleanup method, depending on the needs of your application.

1. Run the MDU and verify that there is an entry for XFPL_REGCLEANUP in the Synergy Method Catalog. If you’re creating a Java JAR file or .NET assembly, assign the XFPL_REGCLEANUP routine an interface name, and then include that interface when you create your component.
2. Write a Synergy routine to perform the cleanup. Cleanup may include closing or releasing files, writing to a log, and so forth. The cleanup routine must be a subroutine (that is, it cannot have a return value) and must have no parameters.
3. Use the MDU to add your cleanup routine to the Synergy Method Catalog.

If you are creating a JAR file or assembly and the cleanup method will be used only with XFPL_REGCLEANUP, you do not have to specify an interface name for the cleanup method because you do not need to include it in your component. If you will call this same cleanup method from your client program to do cleanup on a normal shutdown, you will need to specify an interface name for it and then include it in your component.

4. Call XFPL_REGCLEANUP from your client program and pass the method ID of the cleanup method. You should do this right after starting a session, so that the cleanup method is registered on the server and ready to use should it be needed. If XFPL_REGCLEANUP is called more than once, the most recently registered method will be called when socket communication is lost.
Note

You can also call XFPL_REGCLEANUP from your server code after the session has started. If you plan to call XFPL_REGCLEANUP only from the server code, it does not require an entry in the SMC, so you can skip step 1.

To use XFPL_REGCLEANUP with the pooling support methods

These instructions apply only when you are using the pooling support methods with a Java or .NET client. (For general information about pooling, see Understanding Java pooling or Understanding .NET pooling.)

When you are using pooling, the cleanup method that you write is called both when a session ends abnormally because socket communication has been lost and when a session ends normally.

1. Run the MDU to verify that there is an entry for XFPL_REGCLEANUP in the Synergy Method Catalog. Because XFPL_REGCLEANUP is called automatically when the pool is created, you do not need to assign it an interface name, nor do you need to include it in your Synergy component.
2. Write a Synergy routine to perform the cleanup tasks. For details on writing and using a cleanup method, refer to the relevant sections for your client.
3. Use the MDU to add your cleanup routine to the Synergy Method Catalog.