commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benedikt Ritter <>
Subject [CHAIN] Thoughts about o.a.c.chain2.Chain, o.a.c.chain2.Command and the base classes
Date Thu, 20 Jun 2013 11:01:43 GMT
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.





  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message