Yes, you can register (and unregister) to be notified when a STAF handle no longer exists via what we call "Handle Garbage Collection". However, we don't provide documentation for this functionality as it can be a little tricky to use. If it is used incorrectly it can cause issues.
One of the external STAF services that use "Handle Garbage Collection" is the Resource Pool (ResPool) service. So, you could look at the source code for the ResPool service (it is an external C++ service) to see how it is done in src/staf/services/respool/STAFResPoolService.cpp. It submits a STAF_NOTIFY REGISTER ONENDOFHANDLE request to the local HANDLE service (which is undocumented) to add a notification for when a STAF handle (for a specified STAF instance running on a machine) no longer exists. See the ResPool service's submitSTAFNotifyRegisterRequest() method. For example: STAF local HANDLE STAF_NOTIFY REGISTER ONENDOFHANDLE <Handle#> MACHINE <Endpoint> UUID <uuid> SERVICE <ServiceName> KEY <Key> And it submits a STAF_NOTIFY UNREGISTER ONENDOFHANDLE request to the local HANDLE service (which is undocumented) if it wants to remove the notification. See the ResPool service's submitSTAFNotifyUnregisterRequest() method. For example. STAF local HANDLE STAF_NOTIFY UNREGISTER ONENDOFHANDLE <Handle#> MACHINE <Endpoint> UUID <uuid> SERVICE <ServiceName> KEY <Key> -------------------------------------------------------------- Sharon Lucas IBM Austin, luc...@us.ibm.com (512) 286-7313 or Tieline 363-7313 From: Strösser, Bodo <bodo.stroes...@ts.fujitsu.com> To: "staf-users@lists.sourceforge.net" <staf-users@lists.sourceforge.net>, Date: 09/14/2011 02:03 PM Subject: [staf-users] STAF service: receive notification if a handle is deleted Hi, I would like to write a STAF service, that allows to create instances of a specific test tool (“MyService CREATE ….”), pass commands to it (“MyService DOCMD ….”) and terminate the tool (“MyService DELETE …”). Each test tool instance would be associated with the STAF handle used while doing the CREATE. So it would be fine to have an automatic DELETE on a test tool, when this handle is deleted. So, is there a way to be notified on handle deletion? Bodo ------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA Learn about the latest advances in developing for the BlackBerry® mobile platform with sessions, labs & more. See new tools and technologies. Register for BlackBerry® DevCon today! http://p.sf.net/sfu/rim-devcon-copy1 _______________________________________________ staf-users mailing list staf-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/staf-users
------------------------------------------------------------------------------ BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA Learn about the latest advances in developing for the BlackBerry® mobile platform with sessions, labs & more. See new tools and technologies. Register for BlackBerry® DevCon today! http://p.sf.net/sfu/rim-devcon-copy1
_______________________________________________ staf-users mailing list staf-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/staf-users