logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <mwom...@apache.org>
Subject synchronization problem with listeners in Hierarchy?
Date Tue, 10 Dec 2002 05:32:33 GMT
So, this is some of the code that I added to Hierarchy:

    Requests that a configuration changed event be sent to any registered
    {@link LoggerRepositoryEventListener}.
    @since 1.3*/
  public void fireConfigurationChangedEvent() {
    if(repositoryEventListeners != null) {
      int size = repositoryEventListeners.size();
      LoggerRepositoryEventListener listener;
      for(int i = 0; i < size; i++) {
        listener = (LoggerRepositoryEventListener)

But there are also methods that allow one to remove a given listener from
the hierarchy.  So, there will be a problem here if a listener is removed
while in the for loop to reportiting an event.

What would be the best way to deal with it?  Just add a catch for the index
out of bounds exception or to synchronize on the listener vectors?


To unsubscribe, e-mail:   <mailto:log4j-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:log4j-dev-help@jakarta.apache.org>

View raw message