Hi guys, I had a look at the command interface and it's base classes yesterday, and I think there is some work to do :) Here are the points I found:
* JavaDoc of Command says that commands have to be designed in a thread-safe manner, yet all the base implementations are not thread safe! I have created CHAIN-96 [1] for this, because this definitely has to be fixed before 2.0 * The same is true for o.a.c.chain2.Chain and its base implemenation. For example there is a race condition in o.a.c.chain2.impl.ChainBase.add(CMD). The method first checks the forzen flag and then acts... Another thread may already have altered frozen. I have created CHAIN-97 [2] for this. * The use of Context<K, V> is inconsistent throughout the API. Commands only need a C extends Map<K, V> for execution but the RemoveCommand implements Command<K, V, Context<K, V>>. Why do we need the Context interface anyway? It doesn't add much, the only method is just a generic wrapper around Map.get(Object). * Base implementations should return the constants CONTINUE_PROCESSING or PROCESSING_COMPLETE instead of returning true or false * It may make sense to introduce an enum instead of working with booleans as return values for commands. Thoughts? Benedikt [1] https://issues.apache.org/jira/browse/CHAIN-96 [2] https://issues.apache.org/jira/browse/CHAIN-97 -- http://people.apache.org/~britter/ http://www.systemoutprintln.de/ http://twitter.com/BenediktRitter http://github.com/britter