[fpc-pascal] Threaded webserver and TJSONRPCModule instances: can I be sure there's only one?

Michael Van Canneyt michael at freepascal.org
Fri Oct 21 12:48:11 CEST 2022



On Fri, 21 Oct 2022, Luca Olivetti via fpc-pascal wrote:

> El 21/10/22 a les 9:57, Luca Olivetti via fpc-pascal ha escrit:
>> El 21/10/22 a les 9:48, Luca Olivetti via fpc-pascal ha escrit:
>>> El 21/10/22 a les 9:39, Michael Van Canneyt via fpc-pascal ha escrit:
>>> 
>>>> And a property of your module:
>>>> 
>>>>   property Kind: TWebModuleKind read FWebModuleKind write FWebModuleKind 
>>>> default wkPooled;
>>>> 
>>>> wkPooled is the default, but if you explicitly set this to 'wkPooled' in 
>>>> the constructor, you'll be sure there is only ever 1 instance of the 
>>>> module, which is reused for every request...
>>> 
>>> Thank you,
>>> 
>>> I see that the property isn't published, so it's not available in the 
>>> object inspector.
>>> Can I set it in the DataModuleCreate os is it too late?
>> 
>> I overrode the CreateNew method, I hope that's enough.
>
> I see that Kind is used after the module has been created, so setting it in 
> either method (CreateNew or DataModuleCreate) should be OK, am I right?

You are right.

I will publish the method. That's an oversight.

Michael.


More information about the fpc-pascal mailing list