[Glass] protect temporary files

Otto Behrens otto at finworks.biz
Fri Jun 2 05:09:46 PDT 2023


Hi,

We have zipped files (references stored in GemStone with
MAExternalFileModel) that we use in an operation, for example to merge PDF
data (with PDFTk) or serve to the user via the web server, while it is
temporarily unzipped. The code is something like this:

operation: aBlock
  tempFile := f unzip.
  ^ [ aBlock value: tempFile ] ensure: [ tempFile remove ]

We have on occasion multiple sessions that do operations on the same file,
which causes a problem. We would like to protect the operation with a
semaphore or something like that.

Is a Semaphore the way to solve this or is there a better alternative?

If we use Semaphore and store it on our file object, we cannot commit
because we cannot persist the semaphore instVar. According to the
programming guide, "if you need to encapsulate objects that should not be
persistent, such as semaphores, within object structures that do need to be
persistent and shared".

I am unsure how to structure this or if this is a good idea. Can anyone
please help?

Kind regards

Otto Behrens

+27 82 809 2375
[image: FINWorks]
[image: FINWorks] <http://za.linkedin.com/in/waltherbehrens>
www.finworks.biz

Disclaimer & Confidentiality Note: This email is intended solely for the
use of the individual or entity named above as it may contain information
that is confidential and privileged. If you are not the intended recipient,
be advised that any dissemination, distribution or copying of this email is
strictly prohibited. FINWorks cannot be held liable by any person other
than the addressee in respect of any opinions, conclusions, advice or other
information contained in this email.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gemtalksystems.com/mailman/archives/glass/attachments/20230602/4d2826fa/attachment.htm>


More information about the Glass mailing list