Documentation of class 'ActiveObject':
Object | +--ActiveObject
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 automatcally 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 ... ]
Instance protocol:accessing message handling
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 126.96.36.199; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Sun, 04 Jun 2023 07:19:52 GMT