|
Smalltalk/X WebserverDocumentation of class 'Registry': |
|
|
Class: RegistryInheritance:Object | +--Registry | +--CachingRegistry | +--HandleRegistry
Description:
Registries provide an easy interface to using WeakArrays.
A class, which wants to be informed of instance-death, can put a created object
into a registry. The registry will create an executor, which is a (shallow-)copy
of the object, and watch out for death of the original object. When it dies,
the executor will be sent a #finalize message.
The trick with the shallow copy is especially nice, you can think of it as
being the original object which died.
All objects, which keep external resources (such as fileDescriptors, fonts,
colormap-entries etc.) should be registered, so that the underlying resource
can be freed when the object goes away.
Of course, you too can use it to do whatever you need to do in case of the
death of an object.
Registries use #executor to aquire the copy of the original,
this can be redefined in registered classes for faster copying
(typically, not all internal state but only some device handles are needed for
finalization). I if the to-be-registered object is large, this method may also
return a stub (placeHolder) object. (i.e. there is no need for the copy to be
of the same class as the original, as long as it implements #finalize and frees
the relevant OS resources ...)
Example uses are found in Form, Color, ExternalStream and Font
Related information:
WeakArray
WeakIdentityDictionary
WeakIdentitySet
Font
Form
Color
Cursor
ExternalStream
Instance protocol:accessing
|
|
|
ST/X 6.1.1; WebServer 1.620 at exept:8081; Wed, 23 May 2012 20:56:42 GMT
|