Whether the strategy can be used in multi-task mode timed tasks - update

First, tell us about simple strategy mode

1: This is the directory structure: strategyTest is a test file; environment environmental role; strategy is a strategy interfaces; impl is a concrete implementation strategy; where the package name is my own understanding

You can refer to this article: http://baijiahao.baidu.com/s?id=1601547440739500969&wfr=spider&for=pc

 

2 I understand the strategy pattern: In order to replace if else, switch (current model for this strategy to understand, difficult to maintain, in addition to loaded B seem futile, but there is both interesting, first with the (not so good for the sake of using !!!))

3 tried to reinvent springboot introduction of quartz combined with the Strategy pattern: The reason is that each task has a file, each trigger has a file (you can also write together, in addition to a bit messy), and the task is one to one and a trigger;

4 Results: failed; policy model is more suitable that the same methods to achieve different parameters, this kind of choice should use the factory mode

Guess you like

Origin www.cnblogs.com/xiaoshahai/p/11619375.html