• 执行顺序
    • 在客户端的执行顺序
    • 在服务器端的执行顺序

    执行顺序

    不论是客户端,还是服务器,都可以添加多个过滤器。假设我们按照添加的顺序把它们叫做 filter1, filter2, … filterN。那么它们的执行顺序是这样的。

    在客户端的执行顺序

    1. +------------------- OutputFilter -------------------+
    2. | +-------+ +-------+ +-------+ |
    3. | |filter1|----->|filter2|-----> ... ----->|filterN| |---------+
    4. | +-------+ +-------+ +-------+ | v
    5. +----------------------------------------------------+ +---------------+
    6. | Hprose Server |
    7. +-------------------- InputFilter -------------------+ +---------------+
    8. | +-------+ +-------+ +-------+ | |
    9. | |filter1|<-----|filter2|<----- ... <-----|filterN| |<--------+
    10. | +-------+ +-------+ +-------+ |
    11. +----------------------------------------------------+

    在服务器端的执行顺序

    1. +-------------------- InputFilter -------------------+
    2. | +-------+ +-------+ +-------+ |
    3. +-------->| |filterN|-----> ... ----->|filter2|----->|filter1| |
    4. | | +-------+ +-------+ +-------+ |
    5. +---------------+ +----------------------------------------------------+
    6. | Hprose Client |
    7. +---------------+ +------------------- OutputFilter -------------------+
    8. ^ | +-------+ +-------+ +-------+ |
    9. +---------| |filterN|<----- ... <-----|filter2|<-----|filter1| |
    10. | +-------+ +-------+ +-------+ |
    11. +----------------------------------------------------+