i’ve created a new service
used pooledfactory with 1 instance preinitialized and pbCreateAdditional
now i create 20+ datamodules who all target the one table in this DA service, using a localdatable and a localdataadapter (using it in the same daserver so local)
this is done in a loop, so there is no threaded access to the pool
and yet it isn’t reusing the pool it seems?
error is raised because you have reached end of pooled connections:
uDACore.DAError(True,'Maximum pool size reached. Cannot create a new connection')
you can avoid his error if you set DAConnectionManager.PoolingEnabled to False or redesign your code.
in your case, you have dropped LDA (=local data adapter) to TServerParamProxy so for each TServerParamProxy object, own DataService instance is created.
each DataService instance keeps own IDAConnection.
workaround: use one LDA per service and put it into server datamodule.
note: you have specified pbCreateAdditional in TROPooledClassFactory constructor so it created additional DataService instance at request
but putting the localdataadapter to the dataservice remedies the problem
and introduces a crash on closing the app cause the release of the localdataadapter does not find its service…
furthermore, since i’m now referencing the localdatadapter from the service, this seems kinda recipe for disaster?
i don’t see why the behaviour of a localdataadapter is different from a remote one…
if i do the same with remoteadapter using localchannel it works…
even if the localadapter holds an instance to the service i don’t see why it should block a connection…
i also don’t see why localadapter should keep an instance of the service for exclusive use? that way to many instances are created…?
fClassFactory := nil;
this code is executed before your TComputerIniFilesManager is cleared. it is reason for this error.
workaround: clear this object in FormClose/FormDestroy or similar event.
it keeps it for case when you should do several requests via LDA. it will give you a good performance.
after usage, just clear LDA.ServiceInstance
if you use this code, it will work similar to RDA:
function TServerParamProxy.LoadComputer: boolean;
DALocalDataAdapter.ServiceInstance := nil;
another case: put LDA to server datamodule and all your TServerParamProxy.LocalDataTable should reference to to this LDA. it also give you performance and it will use one server instance and one connection for all requests.
<< another case: put LDA to server datamodule and all your TServerParamProxy.LocalDataTable should reference to to this LDA. it also give you performance and it will use one server instance and one connection for all requests.>>
i want to buidl on this one: since the dataservice is pooled and since it will be used to serve other tables also, how will it just use 1 server instance and 1 connection…
the proxy itself is wrapped in another pooled service which is called by several clients so it can write updates simultaneously…
i want to fully grasp this before running into troubles…