Skip to content
Search

Active object

lastmod 2020-09-22created 2020-09-217 edits

The active object design pattern decouples method execution from method invocation for objects that each reside in their own thread of control. The goal is to introduce concurrency by using asynchronous method invocation and a scheduler for handling requests.

Six elements of the pattern

  • A proxy, which provides an interface towards clients with publicly accessible methods.
  • An interface which defines the method request on an active object.
  • A list of pending requests from clients.
  • A scheduler, which decides which request to execute next.
  • The implementation of the active object method.
  • A callback or variable for the client to receive the result.

Terminology

  • Object: an object; responds immediately when called.
  • Actor: an active object (i.e., it has its own thread and a queue); does not respond immediately when called.
  • Reactor: a structure that, on top of an Actor, maps handlers to the corresponding events and dispatches them. (Selector-like)
  • Proactor: a structure that hands an action over to an Actor and receives the result of that action. (IOCP-like)
  • ActiveObject: hands its request over to an Actor that can act on it, then uses a Future object to get the result.

Projects

See also

Favorite site

author Zer0 sitemap