IRODestructorControllerEx

Overview

IRODestructorControllerEx is an interface that extends IRODestructorController it can be implemented by your service class to control behavior of TROPerClientClassFactory.

Use Case

By default, TROPerClientClassFactory only destroys your service class on timeout. By implementing this interface, you can control the destruction of a service in your code by changing your own flag in the SetCanBeDestroyed method.

Note: TROPerClientClassFactory.ReleaseInstance will use the result of the IRODestructorController.CanBeDestroyed function to determine if your service must be destroyed, so SetCanBeDestroyed has to set your internal flag, so it will later be returned in the CanBeDestroyed function.

Also, due to the nature of this interface, inheritances of your service class must still implement the IRODestructorController interface, as shown below:

TNewService = class(TRORemotable, INewService, IRODestructorControllerEx, IRODestructorController)

Location

Required Methods


CanBeDestroyed    (declared in IRODestructorController)

Whenever TROPerClientClassFactory.ReleaseInstance is called, it will use the result of this function to determine if a service can be destroyed.

function CanBeDestroyed: boolean

SetCanBeDestroyed

procedure SetCanBeDestroyed(Value: boolean)

Parameters:

  • Value: