Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Explain "Active-object" pattern

What is the goal of the Active object pattern? Can you show me any abstract example to understand it easily?

like image 701
Bence Pattogato Avatar asked Jan 16 '17 12:01

Bence Pattogato


People also ask

What is an active object in a file?

So, what is an active object? An active object is a concurrency design pattern enabling reliable and safe asynchronous behavior. A typical active object implementation involves some sort of external API, a concurrency safe queue, and a thread to execute the required behavior.

What is active object and passive object?

A active object owns a thread of control and can initiate control activity. Processes and tasks are types of active objects. Passive. A passive object holds data, but does not initiate control. Multiple instance.

What is concurrent patterns in Java?

Concurrency is the ability to run several or multi programs or applications in parallel. The backbone of Java concurrency is threads (a lightweight process, which has its own files and stacks and can access the shared data from other threads in the same process).

What is concurrency design pattern?

In software engineering, concurrency patterns are those types of design patterns that deal with the multi-threaded programming paradigm. Examples of this class of patterns include: Active Object. Balking pattern. Barrier.


1 Answers

The patern's static object diagram

The Active object pattern's goal is to separate the method calling from method execution. It is like a waiter in a restaurant, who just hands the orders from the customers to the chef.

When a customer orders some food from the waiter

the customer is the Client, the waiter is the Proxy

he writes it up on a paper (obviously doesn't start to cook it),

the paper is the MethodRequest, the table's number on the paper is the Future object

gives the paper to the chef, who decides which cook should prepare it (who has time).

the chef is the Scheduler who has a list of papers (ActivationList) and the cooks are the Servant-s

When the meal is ready, the cook places it on the serve bar and the waiter brings it to the customers table.

Client reads the method's result, from the Result object.

like image 152
Bence Pattogato Avatar answered Sep 25 '22 05:09

Bence Pattogato