Hi,
I have a question about the listener and performance.
For example:
I have 5 class:
+ Add Attachment Listener
+ Priority Field Change Listener
+ Add Comment Listener
+ Change Status of Issue Listener
+ Change Assignee Listener
All of classes will listen on
@EventListener
public void onIssueEvent(IssueEvent issueEvent) {
// Do some thing
}
I have 2 way implemented for this probleam
Option 1:
I register 5 class like this:
eventPublisher.register(AddAttachmentListener.class);
eventPublisher.register(PriorityFieldChangeListener.class);
eventPublisher.register(AddCommentListener.class);
eventPublisher.register(ChangeStatusOfIssueListener.class);
eventPublisher.register(ChangeAssigneeListener.class);
And use in side each class funtion onIssueEvent()
Option 2:
I just register only one class:
eventPublisher.register(IssueEventListener.class);
And in the function onIssueEvent() I will switch to each event.
But, If I register 5 class it will make the code cleaner and easy for reading.
So, which option could I follow?
If I use option 1, will I affect the performance?
Thank you