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.
by Rainer Grimm
From the article:
The Active Object decouples method invocation from method execution. The method invocation is performed on the client thread, but the method execution is on the Active Object. The Active Object has its thread and a list of method request objects (short request) to be executed. The client’s method invocation enqueues the requests on the Active Object’s list. The requests are dispatched to the servant.
When many threads access a shared object synchronized, the following challenges must be solved:
- A thread invoking a processing-intensive member function should not block the other threads invoking the same object for too long.
- It should be easy to synchronize access to a shared object.
- The concurrency characteristics of the executed requests should be adaptable to the concrete hardware and software.