Permalink
Browse files

Minor change to prevent unneeded array initialization

  • Loading branch information...
1 parent 22a7841 commit 9295c50a4d106495f4078f424f1bf72cc0d06d5a @abuijze abuijze committed Jun 14, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 core/src/main/java/org/axonframework/unitofwork/DefaultUnitOfWork.java
@@ -182,7 +182,8 @@ protected void publishEvents() {
}
dispatcherStatus = Status.DISPATCHING;
for (Map.Entry<EventBus, List<EventMessage<?>>> entry : eventsToPublish.entrySet()) {
- EventMessage[] messages = entry.getValue().toArray(new EventMessage[] {});
+ List<EventMessage<?>> messageList = entry.getValue();
+ EventMessage[] messages = messageList.toArray(new EventMessage[messageList.size()]);
if (logger.isDebugEnabled()) {
for (EventMessage message : messages) {
logger.debug("Publishing event [{}] to event bus [{}]",

0 comments on commit 9295c50

Please sign in to comment.