public void addListener ( final FilteredManagerListener < ManagerEvent > listener ) { synchronized ( this . listeners ) { this . listeners . addListener ( listener ) ; synchronized ( this . globalEvents ) { Collection < Class < ? extends ManagerEvent > > expandEvents = expandEvents ( listener . requiredEvents ( ) ) ; this . globalEvents . addAll ( expandEvents ) ; } } logger . debug ( "listener added " + listener ) ; }
Adds a listener which will be sent all events that its filterEvent handler will accept . All events are dispatch by way of a shared queue which is read via a thread which is shared by all listeners . Whilst poor performance of you listener can affect other listeners you can t affect the read thread which takes events from asterisk and enqueues them .