Smalltalk/X WebserverDocumentation of class 'ActiveObject': | ||
Class: ActiveObjectInheritance:Object | +--ActiveObject
Description:an active object executes incoming messages in a serialized, synchronous manner, enqueuing incoming messages, executing them one after the other, and returning results to the caller. Messages are synchronous: the caller is blocked while I perform my duty. Exceptions during execution are sent back to the caller. This is an abstract framework class, to be subclassed for real workers. The following is a not-yet-working experiment, using lookup objects to redirect automatically into a synchronizing method. This does not work yet. Notice the use of the lookup object here: all incoming messages from a process other than my worker-process itself are forwarded to the #doesNotUnderstand: method. There is no need to inherit from nil, and subclasses can use any messages they like locally, without them being enqueued. For now, define methods which have to be synchronized by defining them as: methodX self synchronized:[ ... do something ... ] Class protocol:initialization
Instance protocol:accessing message handling
Private classes:MessageAndResponse RedirectingLookup Examples:normally, one would subclass ActiveObject and put protocol into it; here, for the example, an anon Printer is defined. It is slow printing to the Transcript for a demo. The interesting thing is the error handling which is demonstrated in printWithError: Any exception inside the worker object is returned back and raised in the active-object's client, not in the worker (take a look at the call-chain, when running the example below).
|
||
ST/X 7.7.0.0; WebServer 1.702 at 20f6060372b9.unknown:8081; Mon, 18 Nov 2024 04:24:35 GMT |