@Override public int size() { return ExtensionList.this.size(); } };
public int size() { return storage().size(); }
/** * Convenience method allowing lookup of the only instance of a given type. * Equivalent to {@code ExtensionList.lookup(Class).get(Class)} if there is one instance, * and throws an {@code IllegalStateException} otherwise. * * @param type The type to look up. * @return the singleton instance of the given type in its list. * @throws IllegalStateException if there are no instances, or more than one * * @since 2.87 */ public static @Nonnull <U> U lookupSingleton(Class<U> type) { ExtensionList<U> all = lookup(type); if (all.size() != 1) { throw new IllegalStateException("Expected 1 instance of " + type.getName() + " but got " + all.size()); } return all.get(0); }
if (whitelistProviders.size() > 0) { for (RoutingDecisionProvider provider : whitelistProviders) { RoutingDecisionProvider.Decision methodDecision = provider.decide(signature);
List<Tag> r = new ArrayList<Tag>(exts.size());
if (decisionProviders.size() > 0) { for (RoutingDecisionProvider provider : decisionProviders) { RoutingDecisionProvider.Decision fieldDecision = provider.decide(signature);
/** * Installs the default queue sorter. * * {@link Queue#Queue(LoadBalancer)} is too early to do this */ @Initializer(after=JOB_LOADED) public static void installDefaultQueueSorter() { ExtensionList<QueueSorter> all = all(); if (all.isEmpty()) return; Queue q = Jenkins.getInstance().getQueue(); if (q.getSorter()!=null) return; // someone has already installed something. leave that alone. q.setSorter(all.get(0)); if (all.size()>1) LOGGER.warning("Multiple QueueSorters are registered. Only the first one is used and the rest are ignored: "+all); }
@Override protected T instance(Mapping mapping, ConfigurationContext context) throws ConfiguratorException { final ExtensionList<T> list = Jenkins.getInstance().getExtensionList(target); if (list.size() != 1) { throw new ConfiguratorException("Expected a unique instance of extension "+target); } return (T) list.get(0); }
if (decision.size() > 0) { for (RoutingDecisionProvider provider : decision) { RoutingDecisionProvider.Decision methodDecision = provider.decide(signature);
@Override public int size() { return ExtensionList.this.size(); } };
public int size() { return storage().size(); }
public int size() { return storage().size(); }
public int size() { return storage().size(); }
public int size() { return storage().size(); }
public int size() { return storage().size(); }
/** * Keyed by {@link User#id}. This map is used to ensure * singleton-per-id semantics of {@link User} objects. * * The key needs to be generated by {@link IdStrategy#keyFor(String)}. */ @GuardedBy("User.byNameLock") static ConcurrentMap<String,User> byName() { ExtensionList<AllUsers> instances = ExtensionList.lookup(AllUsers.class); if (instances.size() != 1) { throw new IllegalStateException(); } return instances.get(0).byName; }
@Override public void postInitialize() throws Exception { //Call the following method for force initialization of the ReplicationQueueTaskDispatcher because //it needs to register and listen to GerritEvent. Normally, it is lazy loaded when the first build is started. QueueTaskDispatcher.all().size(); super.postInitialize(); }
@Override protected T instance(Mapping mapping, ConfigurationContext context) throws ConfiguratorException { final ExtensionList<T> list = Jenkins.getInstance().getExtensionList(target); if (list.size() != 1) { throw new ConfiguratorException("Expected a unique instance of extension "+target); } return (T) list.get(0); }
/** * Installs the default queue sorter. * * {@link Queue#Queue(LoadBalancer)} is too early to do this */ @Initializer(after=JOB_LOADED) public static void installDefaultQueueSorter() { ExtensionList<QueueSorter> all = all(); if (all.isEmpty()) return; Queue q = Jenkins.getInstance().getQueue(); if (q.getSorter()!=null) return; // someone has already installed something. leave that alone. q.setSorter(all.get(0)); if (all.size()>1) LOGGER.warning("Multiple QueueSorters are registered. Only the first one is used and the rest are ignored: "+all); }
/** * Installs the default queue sorter. * * {@link Queue#Queue(hudson.model.LoadBalancer)} is too early to do this */ @Initializer(after=JOB_LOADED) public static void installDefaultQueueSorter() { ExtensionList<QueueSorter> all = all(); if (all.isEmpty()) return; Queue q = Hudson.getInstance().getQueue(); if (q.getSorter()!=null) return; // someone has already installed something. leave that alone. q.setSorter(all.get(0)); if (all.size()>1) LOGGER.warning("Multiple QueueSorters are registered. Only the first one is used and the rest are ignored: "+all); }