private AliasFilter(List<ActiveDescriptor<?>> bases) { for (ActiveDescriptor<?> base : bases) { String val = base.getLocatorId() + "." + base.getServiceId(); values.add(val); } }
private static String getAliasMetadataValue(ActiveDescriptor<?> descriptor) { Long locatorId = descriptor.getLocatorId(); Long serviceId = descriptor.getServiceId(); if (locatorId == null || serviceId == null) return ALIAS_FREE_DESCRIPTOR; return locatorId + "." + serviceId; }
private AliasFilter(List<ActiveDescriptor<?>> bases) { for (ActiveDescriptor<?> base : bases) { String val = base.getLocatorId() + "." + base.getServiceId(); values.add(val); } }
private AliasFilter(List<ActiveDescriptor<?>> bases) { for (ActiveDescriptor<?> base : bases) { String val = base.getLocatorId() + "." + base.getServiceId(); values.add(val); } }
private static String getAliasMetadataValue(ActiveDescriptor<?> descriptor) { Long locatorId = descriptor.getLocatorId(); Long serviceId = descriptor.getServiceId(); if (locatorId == null || serviceId == null) return ALIAS_FREE_DESCRIPTOR; return locatorId + "." + serviceId; }
private static String getAliasMetadataValue(ActiveDescriptor<?> descriptor) { Long locatorId = descriptor.getLocatorId(); Long serviceId = descriptor.getServiceId(); if (locatorId == null || serviceId == null) return ALIAS_FREE_DESCRIPTOR; return locatorId + "." + serviceId; }
private AliasFilter(List<ActiveDescriptor<?>> bases) { for (ActiveDescriptor<?> base : bases) { String val = base.getLocatorId() + "." + base.getServiceId(); values.add(val); } }
private static String getAliasMetadataValue(ActiveDescriptor<?> descriptor) { Long locatorId = descriptor.getLocatorId(); Long serviceId = descriptor.getServiceId(); if (locatorId == null || serviceId == null) return ALIAS_FREE_DESCRIPTOR; return locatorId + "." + serviceId; }
private static String oneLineDescriptor(ActiveDescriptor<?> descriptor) { if (descriptor == null) return "null-descriptor"; return descriptor.getImplementation() + ((descriptor.getName() != null) ? "/" + descriptor.getName() : "") + "(" + descriptor.getServiceId() + "," + descriptor.getLocatorId() + "," + System.identityHashCode(descriptor) + ")"; }
private void callAllConfigurationListeners(List<ServiceHandle<?>> allListeners) { if (allListeners == null) return; for (ServiceHandle<?> listener : allListeners) { ActiveDescriptor<?> listenerDescriptor = listener.getActiveDescriptor(); if (listenerDescriptor.getLocatorId() != id) continue; try { ((DynamicConfigurationListener) listener.getService()).configurationChanged(); } catch (Throwable th) { // Intentionally ignore } } }
private void callAllConfigurationListeners(List<ServiceHandle<?>> allListeners) { if (allListeners == null) return; for (ServiceHandle<?> listener : allListeners) { ActiveDescriptor<?> listenerDescriptor = listener.getActiveDescriptor(); if (listenerDescriptor.getLocatorId() != id) continue; try { ((DynamicConfigurationListener) listener.getService()).configurationChanged(); } catch (Throwable th) { // Intentionally ignore } } }
private void callAllConfigurationListeners(List<ServiceHandle<?>> allListeners) { if (allListeners == null) return; for (ServiceHandle<?> listener : allListeners) { ActiveDescriptor<?> listenerDescriptor = listener.getActiveDescriptor(); if (listenerDescriptor.getLocatorId() != id) continue; try { ((DynamicConfigurationListener) listener.getService()).configurationChanged(); } catch (Throwable th) { // Intentionally ignore } } }
@SuppressWarnings("unchecked") @Override public void shutdown() { List<ActiveDescriptor<?>> all = locator.getDescriptors(BuilderHelper.allFilter()); long myLocatorId = locator.getLocatorId(); TreeSet<SystemDescriptor<Object>> singlesOnly = new TreeSet<SystemDescriptor<Object>>( new GenerationComparator()); for (ActiveDescriptor<?> one : all) { if (one.getScope() == null || !one.getScope().equals(Singleton.class.getName())) continue; synchronized (this) { if (one.getCache() == null) continue; } if (one.getLocatorId() == null || one.getLocatorId().longValue() != myLocatorId) continue; SystemDescriptor<Object> oneAsObject = (SystemDescriptor<Object>) one; singlesOnly.add(oneAsObject); } for (SystemDescriptor<Object> one : singlesOnly) { destroyOne(one); } }
private void callAllConfigurationListeners(List<ServiceHandle<?>> allListeners) { if (allListeners == null) return; for (ServiceHandle<?> listener : allListeners) { ActiveDescriptor<?> listenerDescriptor = listener.getActiveDescriptor(); if (listenerDescriptor.getLocatorId() != id) continue; try { ((DynamicConfigurationListener) listener.getService()).configurationChanged(); } catch (Throwable th) { // Intentionally ignore } } }
@SuppressWarnings("unchecked") @Override public void shutdown() { List<ActiveDescriptor<?>> all = locator.getDescriptors(BuilderHelper.allFilter()); long myLocatorId = locator.getLocatorId(); TreeSet<SystemDescriptor<Object>> singlesOnly = new TreeSet<SystemDescriptor<Object>>( new GenerationComparator()); for (ActiveDescriptor<?> one : all) { if (one.getScope() == null || !one.getScope().equals(Singleton.class.getName())) continue; synchronized (this) { if (one.getCache() == null) continue; } if (one.getLocatorId() == null || one.getLocatorId().longValue() != myLocatorId) continue; SystemDescriptor<Object> oneAsObject = (SystemDescriptor<Object>) one; singlesOnly.add(oneAsObject); } for (SystemDescriptor<Object> one : singlesOnly) { destroyOne(one); } }
@SuppressWarnings("unchecked") @Override public void shutdown() { List<ActiveDescriptor<?>> all = locator.getDescriptors(BuilderHelper.allFilter()); long myLocatorId = locator.getLocatorId(); TreeSet<SystemDescriptor<Object>> singlesOnly = new TreeSet<SystemDescriptor<Object>>( new GenerationComparator()); for (ActiveDescriptor<?> one : all) { if (one.getScope() == null || !one.getScope().equals(Singleton.class.getName())) continue; synchronized (this) { if (one.getCache() == null) continue; } if (one.getLocatorId() == null || one.getLocatorId().longValue() != myLocatorId) continue; SystemDescriptor<Object> oneAsObject = (SystemDescriptor<Object>) one; singlesOnly.add(oneAsObject); } for (SystemDescriptor<Object> one : singlesOnly) { destroyOne(one); } }
@SuppressWarnings("unchecked") @Override public void shutdown() { List<ActiveDescriptor<?>> all = locator.getDescriptors(BuilderHelper.allFilter()); long myLocatorId = locator.getLocatorId(); TreeSet<SystemDescriptor<Object>> singlesOnly = new TreeSet<SystemDescriptor<Object>>( new GenerationComparator()); for (ActiveDescriptor<?> one : all) { if (one.getScope() == null || !one.getScope().equals(Singleton.class.getName())) continue; synchronized (this) { if (one.getCache() == null) continue; } if (one.getLocatorId() == null || one.getLocatorId().longValue() != myLocatorId) continue; SystemDescriptor<Object> oneAsObject = (SystemDescriptor<Object>) one; singlesOnly.add(oneAsObject); } for (SystemDescriptor<Object> one : singlesOnly) { destroyOne(one); } }
/** * This method will add the ability to use the {@link Immediate} scope to * the given locator. If the locator already has a {@link Context} implementation * that handles the {@link Immediate} scope this method does nothing. The Immediate * scope will start in the suspended state, allowing the caller to customize the * Immediate scope using the {@link ImmediateController} * <p> * * @param locator The non-null locator to enable the Immediate scope on * @return The ImmediateController that can be used to further configure * the Immediate scope * @throws MultiException if there were errors when committing the service */ public static ImmediateController enableImmediateScopeSuspended(ServiceLocator locator) { List<ServiceHandle<?>> immediateContexts = locator.getAllServiceHandles((new TypeLiteral<Context<Immediate>>() {}).getType()); for (ServiceHandle<?> immediateContext : immediateContexts) { ActiveDescriptor<?> contextDescriptor = immediateContext.getActiveDescriptor(); if (contextDescriptor.getLocatorId() == locator.getLocatorId()) { return locator.getService(ImmediateController.class); } } addClasses(locator, ImmediateContext.class, ImmediateHelper.class); return locator.getService(ImmediateController.class); }
/** * This method will add the ability to use the {@link Immediate} scope to * the given locator. If the locator already has a {@link Context} implementation * that handles the {@link Immediate} scope this method does nothing. The Immediate * scope will start in the suspended state, allowing the caller to customize the * Immediate scope using the {@link ImmediateController} * <p> * * @param locator The non-null locator to enable the Immediate scope on * @return The ImmediateController that can be used to further configure * the Immediate scope * @throws MultiException if there were errors when committing the service */ public static ImmediateController enableImmediateScopeSuspended(ServiceLocator locator) { List<ServiceHandle<?>> immediateContexts = locator.getAllServiceHandles((new TypeLiteral<Context<Immediate>>() {}).getType()); for (ServiceHandle<?> immediateContext : immediateContexts) { ActiveDescriptor<?> contextDescriptor = immediateContext.getActiveDescriptor(); if (contextDescriptor.getLocatorId() == locator.getLocatorId()) { return locator.getService(ImmediateController.class); } } addClasses(locator, ImmediateContext.class, ImmediateHelper.class); return locator.getService(ImmediateController.class); }
/** * This method will add the ability to use the {@link Immediate} scope to * the given locator. If the locator already has a {@link Context} implementation * that handles the {@link Immediate} scope this method does nothing. The Immediate * scope will start in the suspended state, allowing the caller to customize the * Immediate scope using the {@link ImmediateController} * <p> * * @param locator The non-null locator to enable the Immediate scope on * @return The ImmediateController that can be used to further configure * the Immediate scope * @throws MultiException if there were errors when committing the service */ public static ImmediateController enableImmediateScopeSuspended(ServiceLocator locator) { List<ServiceHandle<?>> immediateContexts = locator.getAllServiceHandles((new TypeLiteral<Context<Immediate>>() {}).getType()); for (ServiceHandle<?> immediateContext : immediateContexts) { ActiveDescriptor<?> contextDescriptor = immediateContext.getActiveDescriptor(); if (contextDescriptor.getLocatorId() == locator.getLocatorId()) { return locator.getService(ImmediateController.class); } } addClasses(locator, ImmediateContext.class, ImmediateHelper.class); return locator.getService(ImmediateController.class); }