Skip to content

Commit

Permalink
Merge pull request #49 from sonyxperiadev/diagnostics
Browse files Browse the repository at this point in the history
Added methods to get a read only view of registered listeners
  • Loading branch information
rsandell committed Feb 29, 2016
2 parents 0ab7590 + b7e495d commit a613548
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.io.Reader;
import java.util.Collections;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArraySet;

Expand Down Expand Up @@ -279,6 +280,16 @@ public void removeListeners() {
listeners.clear();
}

/**
* Returns an unmodifiable view of the set of {@link ConnectionListener}s.
*
* @return the set of connection listeners.
* @see Collections#unmodifiableSet(Set)
*/
public Set<ConnectionListener> getListenersView() {
return Collections.unmodifiableSet(listeners);
}

/**
* Sets {@link AuthenticationUpdater}.
* @param authenticationUpdater The {@link AuthenticationUpdater}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -241,6 +242,16 @@ public int getEventListenersCount() {
return gerritEventListeners.size();
}

/**
* Returns an unmodifiable view of the set of {@link GerritEventListener}s.
*
* @return a list of the registered event listeners.
* @see Collections#unmodifiableSet(Set)
*/
public Set<GerritEventListener> getGerritEventListenersView() {
return Collections.unmodifiableSet(gerritEventListeners);
}

/**
* Gets the number of event worker threads.
*
Expand Down

0 comments on commit a613548

Please sign in to comment.