Skip to content

Commit

Permalink
Boyscout the javadoc
Browse files Browse the repository at this point in the history
-Boyscout the javadoc
-Add comment for intermediate '.collect(Collectors.toList())', which
solves a ConcurrentModificationException

[#388]
  • Loading branch information
smcvb committed Nov 23, 2017
1 parent 94ea6bd commit dcab5f3
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,10 @@ public class AnnotatedChildEntity<P, C> implements ChildEntity<P> {
* Initiates a new AnnotatedChildEntity instance that uses the provided {@code entityModel} to delegate command
* and event handling to an annotated child entity.
*
* @param entityModel a {@link EntityModel} describing
* the entity.
* @param forwardCommands flag indicating whether commands should be forwarded to the entity
* @param commandTargetResolver resolver for command handler methods on the target
* @param eventTargetResolver resolver for event handler methods on the target
* @param entityModel A {@link EntityModel} describing the entity.
* @param forwardCommands Flag indicating whether commands should be forwarded to the entity.
* @param commandTargetResolver Resolver for command handler methods on the target.
* @param eventTargetResolver Resolver for event handler methods on the target.
*/
@SuppressWarnings("unchecked")
public AnnotatedChildEntity(EntityModel<C> entityModel,
Expand All @@ -70,7 +69,7 @@ public AnnotatedChildEntity(EntityModel<C> entityModel,
@Override
public void publish(EventMessage<?> msg, P declaringInstance) {
eventTargetResolver.apply(msg, declaringInstance)
.collect(Collectors.toList())
.collect(Collectors.toList()) // Creates copy to prevent ConcurrentModificationException.
.forEach(target -> entityModel.publish(msg, target));
}

Expand Down

0 comments on commit dcab5f3

Please sign in to comment.