Message Processing in powerplant

Source: Internet
Author: User

Today, I have basically understood lcommander and llistener/lboradcaster in powerplant.

Lcommander is used to process commands step by step. Each lcommander instance has a msupercommander pointer pointing to its parent-level object.
The msupercommander pointer of the lcommander instance is null. Each lcommander
Objects (for example, classes inherited from lcommander and other classes) can be constructed or you can call setsupercommander to attach yourself to the parent lcommander class.
Of course, the parent class can also use addsubcommander to actively add lower-level lcommander objects. In this way, when the lower-level lcommander object calls
Processcommand sends a message, and the parent class object can receive and process the message in obeycommand. Note that only the parent class can process the message.

Llistener/lbroadcaster adopts a more flexible method, that is, it is no longer divided into parent-child relationships, as long as it is inherited from lbroadcaster classes.
If broadcastmessage is used to send messages, all classes inherited from llistener can receive and process messages through listentomessage. However
Note: Not after a message is sent, the listentomessage of all classes will process the message. Only addlistener of the lbroadcaster class is called.
Or the addbroadcaster of the llistener class adds the class inherited from lbroadcaster to the listener queue of the listener class.
.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.