Fix concurrency issues when publishing ZAP events
Fix concurrency issues when publishing ZAP events

Change SimpleEventBus to control the read/write accesses to the
publishers and consumers to prevent concurrency issues. For example,
when a consumer is unregistered while publishing events, which could
lead to exceptions, e.g.:
java.util.ConcurrentModificationException
 at java.util.ArrayList$Itr.checkForComodification(...)
 at java.util.ArrayList$Itr.next(...)
 at o.z.z.eventBus.SimpleEventBus.publishSyncEvent(...)
 at o.z.z.extension.alert.ExtensionAlert.publishAlertEvent(...)
 at o.z.z.extension.alert.ExtensionAlert.alertFound(...)
 at o.z.z.extension.pscan.PassiveScanThread.raiseAlert(...)
(packages reduced/omitted to keep the lines short)

Only one thread (write access) is allowed to manage the publishers and
consumers while multiple threads can publish events (read access), as
long no thread is managing the publishers or the consumers.
Change the classes RegisteredConsumer and RegisteredPublisher to be
static as they don't need to access the state of SimpleEventBus class.

kingthorin/zaproxy,kingthorin/zaproxy,Harinus/zaproxy,kingthorin/zaproxy,gmaran23/zaproxy,Harinus/zaproxy,kingthorin/zaproxy,psiinon/zaproxy,thc202/zaproxy,thc202/zaproxy,meitar/zaproxy,psiinon/zaproxy,NVolcz/zaproxy,gsavastano/zaproxy,NVolcz/zaproxy,Ali-Razmjoo/zaproxy,Ali-Razmjoo/zaproxy,Ali-Razmjoo/zaproxy,thc202/zaproxy,zapbot/zaproxy,psiinon/zaproxy,Ali-Razmjoo/zaproxy,Ali-Razmjoo/zaproxy,meitar/zaproxy,gsavastano/zaproxy,gsavastano/zaproxy,Ali-Razmjoo/zaproxy,psiinon/zaproxy,kingthorin/zaproxy,gmaran23/zaproxy,zaproxy/zaproxy,gsavastano/zaproxy,zaproxy/zaproxy,NVolcz/zaproxy,gmaran23/zaproxy,meitar/zaproxy,thc202/zaproxy,Ali-Razmjoo/zaproxy,meitar/zaproxy,zapbot/zaproxy,psiinon/zaproxy,gmaran23/zaproxy,zapbot/zaproxy,gmaran23/zaproxy,kingthorin/zaproxy,Harinus/zaproxy,zaproxy/zaproxy,psiinon/zaproxy,thc202/zaproxy,gsavastano/zaproxy,zaproxy/zaproxy,meitar/zaproxy,thc202/zaproxy,Harinus/zaproxy,zapbot/zaproxy,zaproxy/zaproxy,zaproxy/zaproxy,meitar/zaproxy,gmaran23/zaproxy,kingthorin/zaproxy,meitar/zaproxy,NVolcz/zaproxy,thc202/zaproxy,zapbot/zaproxy,gmaran23/zaproxy,NVolcz/zaproxy,Harinus/zaproxy,zapbot/zaproxy,Harinus/zaproxy,meitar/zaproxy,zaproxy/zaproxy,gsavastano/zaproxy,zapbot/zaproxy,NVolcz/zaproxy,gsavastano/zaproxy,psiinon/zaproxy,Harinus/zaproxy,NVolcz/zaproxy