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

Hello,

I'm using a TFPHTTPServerHandler in threaded mode.
I'm also using a TJSONRpcModule.
I see that, even if the calls come from different threads, only one instance of the rpc module is ever created (on demand, the first time an rpc request comes in) and used. Since I'm relying on this behaviour, can I be 100% sure it's by design and not a quirk of my test setup?

It is controllable.

There is the 'Modulekind' : wkPooled.

Type
  TWebModuleKind = (wkPooled, wkOneShot{, wkSession});

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...

Michael.
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to