Responsibility chain Model

Source: Internet
Author: User
1, responsibility Chain mode: so that multiple objects have the opportunity to process the request, thus avoiding the coupling between the sender and the recipient of the request. Link this object to a chain and pass the request along this chain to instruct an object to handle it. 2, Advantages: (1), when the customer submits an application, the request is passed along the chain until there is an object responsible for processing its location. At the client there is no need to know who is doing the processing. (2), simplifying the connection of objects, they only need to maintain a reference to the subsequent successor, and do not need to maintain all of its candidate recipients of the reference. (3), can add or modify the structure of processing a request at any time. Increased flexibility in the role of the object solitaire. 3, note: A request is most likely to the end of the chain is not processed, or because there is no correct configuration to be processed. This must be considered at design time. 4. Composition:(1), abstract Processor (Handler) role: Defines an interface for processing requests. If necessary, the interface can define a method to set and return a reference to the home. This role is typically implemented by a Java abstract class or Java interface. The aggregation relationship of the handler class gives a reference to the sub-class, and the abstract Method HandleRequest () regulates the operation of the sub-class processing request. (2), the specific processor (Concretehandler) role: When the specific processor receives the request, you can choose to dispose of the request, or pass the request to the other person. As the specific processor holds references to the homes, the specific processor can access the homes if necessary.

Responsibility chain Model

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.