Express (Distributed operating systems), v8.0 > Secure applications and their environment > Authenticate users > Select a registry or repository > Manage realms in a federated repository > Virtual member manager > Develop with virtual member manager > Extend virtual member manager functionality in the application > Plug-in manager for virtual member manager
State preservation and avoiding infinite recursion
A unique identifier (UID) is associated with every call into the plug-in manager.
The UID facilitates logging, detection of infinite recursion, and state preservation between preExit and postExit method calls, as illustrated in the scenario shown next.
Figure 1. Avoiding infinite recursion
This scenario shows an occurrence of infinite recursion:
- Step 1: An application calls the create() API of virtual member manager and the preExit method of the plug-in manager is called at the very beginning of the create() API.
- Step 2: The plug-in manager calls the preExit method of the JMS Notification Subscriber.
- Step 3: The plug-in manager calls the preExit method of ABCSoftGroup Modification Subscriber.
- Step 4: The plug-in manager calls the preExit method of XYZSoftGroup Modification Subscriber.
- Step 5: The preExit method of the XYZSoftGroup Modification Subscriber calls the virtual member manager create() API which causes the recursion and leads to an infinite loop.
However, in the first step, the preExit method of the plug-in manager inserts a UID into the Context object of the data object. The value of the UID is a List object to which a new UID is appended during the second call.
The subscribers are responsible for checking to avoid infinite recursion for the following reasons:
- Avoid performance issues for every check that occurs in the plug-in manager.
- A subset of the recursion might be preferable at a subscriber level based on the context of the data object.
We can use the same UID for state preservation between various subscriber calls. If the subscriber calls a new topic emitter, copy the UID back into the new data object to avoid infinite recursion. State preservation enables a subscriber to correlate the preExit method call with the postExit method call.
Parent topic: Plug-in manager for virtual member manager
Configure the plug-in manager
Plug-in manager error handling