[Seaside] Ressource management
Hans N Beck
hnbeck at t-online.de
Wed May 24 19:22:02 UTC 2006
thank you for the hints, they will be useful, I think :-)
Am 23.05.2006 um 15:40 schrieb Bany, Michel:
>> to seaside I'm certainly a beginner, and from this it is not
>> clear to me what rules there are for proper ressource
>> management. I had the problem with ODBC connections, which
>> were catched by WASessions (I think). Only a "Cache clean"
>> killed the ODBC instances.
>> Where would be a good place to clean - up i.e. database connections ?
> In one of my projects, we are using Seaside in VW for building a UI
> for a service that is running on a mainframe. The communication
> the UI and the service is based upon socket connections which are
> out of a pool. We have a mechanism for obtaining socket connections
> from the pool and another one for releasing and cleaning them up. The
> connections are obtained lazily as needed and released as early as
> when no longer needed, to make sure that socket connections with the
> mainframe are held as briefly as possible.
> Although this is not database connections, these ideas may be reusable
> in your case.
> For robustness, we need to make sure that socket connections are
> released in all situations, so we have subclassed WASession and
> #responseForRequest: with something like this :
> responseForRequest: aRequest
> [response := super responseForRequest: aRequest]
> ensure: [self releaseResourcesForRequest: aRequest
> response: response].
> We are not using #unregistered, since we are not holding any socket
> connection resource between HTTP requests.
> For even more robustness (when something weird occurs while executing
> the ensure block above), we also subclassed WAProcessMonitor and
> #terminate with something like this:
> | theProcess |
> (theProcess := process) ifNotNil:
> [theProcess terminate.
> self releaseResourcesForProcess: theProcess].
> The WAProcessMonitor object is instantiated in the #initialize method
> of our WASession subclass
> super initialize.
> monitor := MyProcessMonitor new.
> Seaside mailing list
> Seaside at lists.squeakfoundation.org
More information about the Seaside