嗨,我想知道责任链范围。
一般来说,这是一种常用的模式,它本身有处理程序,每个处理程序都将功能操作传递给它的主管。
我在示例场景中看到的是:
"Only one related handler is handling the functionality itself and all the other handlers
are just passing through to their supervisor handler."
在这种情况下是否违反了责任链模式:
"Every handler has the responsibility to take an action instead and after that passing
to supervisor.
作为摘要:
Chain of Responsibility Recommended Scenario:
Handler1(Take No Action) --> Handler2 (Take No Action) --> Handler3(Take All Action)
Chain of Responsibility Wondering Scenario:
Handler1(Take Partial Action) --> Handler2(Take No Action) --> Handler(Take Partial Action)
第二种情况适合责任链还是违反责任链?
例如,Netty 本身有处理程序,并且都有其负责的操作,并且它们还在它们之间传递信息。我们可以说 Netty 处理程序机制适合责任链吗?