Re: [fpc-pascal] Threaded webserver and TJSONRPCModule instances: can I be sure there's only one?
El 21/10/22 a les 17:09, Luca Olivetti via fpc-pascal ha escrit: El 21/10/22 a les 12:48, Michael Van Canneyt via fpc-pascal ha escrit: 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. Meanwhile I changed the method I use to route the calls to the main thread (Application.QueueAsyncCall instead of a critical section and Synchronize) so it doesn't matter any more if there is just one instance or more than one. Now that I think of it, even with the previous method it wouldn't have mattered (since each instance would have been using its own critical section and other fields). Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threaded webserver and TJSONRPCModule instances: can I be sure there's only one?
El 21/10/22 a les 12:48, Michael Van Canneyt via fpc-pascal ha escrit: 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. Meanwhile I changed the method I use to route the calls to the main thread (Application.QueueAsyncCall instead of a critical section and Synchronize) so it doesn't matter any more if there is just one instance or more than one. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threaded webserver and TJSONRPCModule instances: can I be sure there's only one?
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.___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threaded webserver and TJSONRPCModule instances: can I be sure there's only one?
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? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threaded webserver and TJSONRPCModule instances: can I be sure there's only one?
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. Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threaded webserver and TJSONRPCModule instances: can I be sure there's only one?
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? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
Re: [fpc-pascal] Threaded webserver and TJSONRPCModule instances: can I be sure there's only one?
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
[fpc-pascal] Threaded webserver and TJSONRPCModule instances: can I be sure there's only one?
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? Bye -- Luca ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal