public synchronized Map<Throwable, Integer> getExceptions() { if (_exceptions == null) { return Collections.emptyMap(); } final Map<Throwable, Integer> result = new HashMap<Throwable, Integer>(); for (final ExceptionWrapper exception : _exceptions.keySet()) { result.put(exception.getException(), exception.getCount()); } return result; }
/** * Merge information from the other context into this (a root context). The caller must be the * thread that was working with the other context. * * @param context the other context */ public synchronized void mergeThreadContext(final GraphBuildingContext context) { if (_exceptions == null) { _exceptions = new HashMap<ExceptionWrapper, ExceptionWrapper>(); } if (context._exceptions != null) { for (final ExceptionWrapper exception : context._exceptions.keySet()) { final ExceptionWrapper existing = _exceptions.get(exception); if (existing != null) { existing.incrementCount(exception.getCount()); } else { _exceptions.put(exception, exception); } } } }