/** * First positive integer that is not present in started set. * * @param started Already started indices. * @return First positive integer that is not present in started set. */ private int nextIndex(Collection<Integer> started) { assert started.contains(0); for (int i = 1; i < 10000; i++) { if (!started.contains(i)) return i; } throw new IllegalStateException(); }
/** * @param meta Request metadata. * @return {@code True} if class loader is obsolete. */ private boolean isDeadClassLoader(GridDeploymentMetadata meta) { assert Thread.holdsLock(mux); synchronized (mux) { if (deadClsLdrs.contains(meta.classLoaderId())) { if (log.isDebugEnabled()) log.debug("Ignoring request for obsolete class loader: " + meta); return true; } return false; } }
/** {@inheritDoc} */ @Override public Collection<GridDeployment> getDeployments() { Collection<GridDeployment> deps = new ArrayList<GridDeployment>(); synchronized (mux) { for (List<GridDeployment> depList : cache.values()) { for (GridDeployment d : depList) { if (!deps.contains(d)) { deps.add(d); } } } return deps; } }