Refine search
@Override public void addListener(ServiceLocatorListener listener) { if (listener == null) throw new IllegalArgumentException(); synchronized (lock) { if (listeners.contains(listener)) return; try { HashSet<ServiceLocator> currentLocators = new HashSet<ServiceLocator>(serviceLocators.values()); listener.initialize(Collections.unmodifiableSet(currentLocators)); } catch (Throwable th) { // Not added to the set of listeners Logger.getLogger().debug(getClass().getName(), "addListener " + listener, th); return; } listeners.add(listener); } }
@Override public void addListener(ServiceLocatorListener listener) { if (listener == null) throw new IllegalArgumentException(); synchronized (lock) { if (listeners.contains(listener)) return; try { HashSet<ServiceLocator> currentLocators = new HashSet<ServiceLocator>(serviceLocators.values()); listener.initialize(Collections.unmodifiableSet(currentLocators)); } catch (Throwable th) { // Not added to the set of listeners Logger.getLogger().debug(getClass().getName(), "addListener " + listener, th); return; } listeners.add(listener); } }
@Override public void addListener(ServiceLocatorListener listener) { if (listener == null) throw new IllegalArgumentException(); synchronized (lock) { if (listeners.contains(listener)) return; try { HashSet<ServiceLocator> currentLocators = new HashSet<ServiceLocator>(serviceLocators.values()); listener.initialize(Collections.unmodifiableSet(currentLocators)); } catch (Throwable th) { // Not added to the set of listeners Logger.getLogger().debug(getClass().getName(), "addListener " + listener, th); return; } listeners.add(listener); } }
@Override public void addListener(ServiceLocatorListener listener) { if (listener == null) throw new IllegalArgumentException(); synchronized (lock) { if (listeners.contains(listener)) return; try { HashSet<ServiceLocator> currentLocators = new HashSet<ServiceLocator>(serviceLocators.values()); listener.initialize(Collections.unmodifiableSet(currentLocators)); } catch (Throwable th) { // Not added to the set of listeners Logger.getLogger().debug(getClass().getName(), "addListener " + listener, th); return; } listeners.add(listener); } }
/** * Called by the Generator, and hence must be a public method * * @param name The name of this locator * @param parent The parent of this locator (may be null) */ public ServiceLocatorImpl(String name, ServiceLocatorImpl parent) { locatorName = name; this.parent = parent; if (parent != null) { parent.addChild(this); } id = getAndIncrementLocatorId(); Logger.getLogger().debug("Created ServiceLocator " + this); if (BIND_TRACING_PATTERN != null) { Logger.getLogger().debug("HK2 will trace binds and unbinds of " + BIND_TRACING_PATTERN + " with stacks " + BIND_TRACING_STACKS + " in " + this); } }
/** * Sets the given field to the given value * * @param field The non-null field to set * @param instance The non-null instance to set into * @param value The value to which the field should be set * @throws Throwable If there was some exception while setting the field */ public static void setField(Field field, Object instance, Object value) throws Throwable { setAccessible(field); try { field.set(instance, value); } catch (IllegalArgumentException e) { Logger.getLogger().debug(field.getDeclaringClass().getName(), field.getName(), e); throw e; } catch (IllegalAccessException e) { Logger.getLogger().debug(field.getDeclaringClass().getName(), field.getName(), e); throw e; } }
/** * Sets the given field to the given value * * @param field The non-null field to set * @param instance The non-null instance to set into * @param value The value to which the field should be set * @throws Throwable If there was some exception while setting the field */ public static void setField(Field field, Object instance, Object value) throws Throwable { setAccessible(field); try { field.set(instance, value); } catch (IllegalArgumentException e) { Logger.getLogger().debug(field.getDeclaringClass().getName(), field.getName(), e); throw e; } catch (IllegalAccessException e) { Logger.getLogger().debug(field.getDeclaringClass().getName(), field.getName(), e); throw e; } }
/** * Sets the given field to the given value * * @param field The non-null field to set * @param instance The non-null instance to set into * @param value The value to which the field should be set * @throws Throwable If there was some exception while setting the field */ public static void setField(Field field, Object instance, Object value) throws Throwable { setAccessible(field); try { field.set(instance, value); } catch (IllegalArgumentException e) { Logger.getLogger().debug(field.getDeclaringClass().getName(), field.getName(), e); throw e; } catch (IllegalAccessException e) { Logger.getLogger().debug(field.getDeclaringClass().getName(), field.getName(), e); throw e; } }