fix the concurrent problem of handlers in ResponsePromise#188
fix the concurrent problem of handlers in ResponsePromise#188mashirofang wants to merge 2 commits intojurmous:masterfrom
Conversation
|
maybe we just need a CopyOnWriteList instead of the lock/unlock |
|
ok , I would conside this better way tomorrow, and commit a new version |
I think only using CopyOnWriteList may not solve the problem. In this case we won't have any ConcurrentModificationException , but anothor problem might happen that the handler we want to add might be invoked twice both in event-group-thread and user-defined-thread (in a very low probability we addListener just after event-group-thread sets success/exception and before gets iterator of the list to loop ) . So methods such as "addListener" , "handlePromise" and "setException" must be invoked atomicity . Lock/unlock can solve the probleam , but may not good enough , I would spend more time to think it over. |
|
@lburgazzoli |
#187
just using a lock to control the concurrent operations