summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--jdisc_core_test/test_bundles/cert-k-pkgs/src/main/java/com/yahoo/jdisc/bundle/k/CertificateK.java1
-rw-r--r--yolean/abi-spec.json82
-rw-r--r--yolean/src/main/java/com/yahoo/yolean/chain/Chain.java100
-rw-r--r--yolean/src/main/java/com/yahoo/yolean/chain/ChainBuilder.java250
-rw-r--r--yolean/src/main/java/com/yahoo/yolean/chain/ChainCycleException.java27
-rw-r--r--yolean/src/main/java/com/yahoo/yolean/chain/Dependencies.java194
-rw-r--r--yolean/src/main/java/com/yahoo/yolean/chain/DirectedGraph.java108
-rw-r--r--yolean/src/main/java/com/yahoo/yolean/chain/EnumeratedIdentitySet.java185
-rw-r--r--yolean/src/main/java/com/yahoo/yolean/chain/Vertex.java10
-rw-r--r--yolean/src/main/java/com/yahoo/yolean/concurrent/ConcurrentResourcePool.java6
-rw-r--r--yolean/src/main/java/com/yahoo/yolean/concurrent/ResourceFactory.java18
-rw-r--r--yolean/src/main/java/com/yahoo/yolean/concurrent/ResourcePool.java6
12 files changed, 0 insertions, 987 deletions
diff --git a/jdisc_core_test/test_bundles/cert-k-pkgs/src/main/java/com/yahoo/jdisc/bundle/k/CertificateK.java b/jdisc_core_test/test_bundles/cert-k-pkgs/src/main/java/com/yahoo/jdisc/bundle/k/CertificateK.java
index 17a9ca29b1d..34ff4124cd5 100644
--- a/jdisc_core_test/test_bundles/cert-k-pkgs/src/main/java/com/yahoo/jdisc/bundle/k/CertificateK.java
+++ b/jdisc_core_test/test_bundles/cert-k-pkgs/src/main/java/com/yahoo/jdisc/bundle/k/CertificateK.java
@@ -31,7 +31,6 @@ public class CertificateK {
private final com.yahoo.jdisc.application.AbstractApplication application = null;
private final com.yahoo.jdisc.handler.AbstractRequestHandler handler = null;
private final com.yahoo.jdisc.service.AbstractClientProvider client = null;
- private final com.yahoo.yolean.chain.Chain<?> chain = null;
private final com.yahoo.yolean.concurrent.ThreadRobustList<?> robustList = null;
private final com.yahoo.yolean.trace.TraceNode traceNode = null;
private final com.sun.security.auth.LdapPrincipal principal = null;
diff --git a/yolean/abi-spec.json b/yolean/abi-spec.json
index 8c10006e7e1..5085f67811c 100644
--- a/yolean/abi-spec.json
+++ b/yolean/abi-spec.json
@@ -109,72 +109,6 @@
],
"fields": []
},
- "com.yahoo.yolean.chain.Chain": {
- "superClass": "java.lang.Object",
- "interfaces": [
- "java.lang.Iterable"
- ],
- "attributes": [
- "public",
- "final"
- ],
- "methods": [
- "public varargs void <init>(java.lang.String, java.lang.Object[])",
- "public void <init>(java.lang.String, java.util.List)",
- "public java.lang.String id()",
- "public boolean isEmpty()",
- "public java.util.Iterator iterator()",
- "public java.lang.String toString()",
- "public int hashCode()",
- "public boolean equals(java.lang.Object)",
- "public boolean equals(com.yahoo.yolean.chain.Chain)"
- ],
- "fields": []
- },
- "com.yahoo.yolean.chain.ChainBuilder": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public",
- "final"
- ],
- "methods": [
- "public void <init>(java.lang.String)",
- "public final varargs com.yahoo.yolean.chain.ChainBuilder add(java.lang.Object, com.yahoo.yolean.chain.Dependencies[])",
- "public com.yahoo.yolean.chain.Chain build()"
- ],
- "fields": []
- },
- "com.yahoo.yolean.chain.ChainCycleException": {
- "superClass": "java.lang.RuntimeException",
- "interfaces": [],
- "attributes": [
- "public"
- ],
- "methods": [
- "public void <init>(java.util.List)",
- "public java.util.List components()"
- ],
- "fields": []
- },
- "com.yahoo.yolean.chain.Dependencies": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public"
- ],
- "methods": [
- "public static varargs com.yahoo.yolean.chain.Dependencies before(java.lang.Object[])",
- "public static varargs com.yahoo.yolean.chain.Dependencies before(java.lang.Class[])",
- "public static varargs com.yahoo.yolean.chain.Dependencies before(java.lang.String[])",
- "public static varargs com.yahoo.yolean.chain.Dependencies after(java.lang.Object[])",
- "public static varargs com.yahoo.yolean.chain.Dependencies after(java.lang.Class[])",
- "public static varargs com.yahoo.yolean.chain.Dependencies after(java.lang.String[])",
- "public static varargs com.yahoo.yolean.chain.Dependencies provides(java.lang.String[])",
- "public static com.yahoo.yolean.chain.Dependencies emptyDependencies()"
- ],
- "fields": []
- },
"com.yahoo.yolean.chain.Provides": {
"superClass": "java.lang.Object",
"interfaces": [
@@ -200,7 +134,6 @@
"public"
],
"methods": [
- "public void <init>(com.yahoo.yolean.concurrent.ResourceFactory)",
"public void <init>(java.util.function.Supplier)",
"public void preallocate(int)",
"public final java.lang.Object alloc()",
@@ -265,20 +198,6 @@
],
"fields": []
},
- "com.yahoo.yolean.concurrent.ResourceFactory": {
- "superClass": "java.lang.Object",
- "interfaces": [],
- "attributes": [
- "public",
- "abstract"
- ],
- "methods": [
- "public void <init>()",
- "public abstract java.lang.Object create()",
- "public final java.util.function.Supplier asSupplier()"
- ],
- "fields": []
- },
"com.yahoo.yolean.concurrent.ResourcePool": {
"superClass": "java.lang.Object",
"interfaces": [
@@ -289,7 +208,6 @@
"final"
],
"methods": [
- "public void <init>(com.yahoo.yolean.concurrent.ResourceFactory)",
"public void <init>(java.util.function.Supplier)",
"public java.lang.Object alloc()",
"public void free(java.lang.Object)",
diff --git a/yolean/src/main/java/com/yahoo/yolean/chain/Chain.java b/yolean/src/main/java/com/yahoo/yolean/chain/Chain.java
deleted file mode 100644
index 516e3786f28..00000000000
--- a/yolean/src/main/java/com/yahoo/yolean/chain/Chain.java
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.yolean.chain;
-
-import com.google.common.collect.ImmutableList;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.List;
-
-import static java.util.Objects.requireNonNull;
-
-/**
- * An immutable and ordered list of components
- *
- * @author Tony Vaagenes
- * @deprecated Will be removed in Vespa 8 with no replacement.
- */
-@Deprecated
-public final class Chain<T> implements Iterable<T> {
-
- private final String id;
- private final Collection<T> components;
-
- @SafeVarargs
- @SuppressWarnings("varargs")
- public Chain(String id, T... components) {
- this(id, Arrays.asList(components));
- }
-
- public Chain(String id, List<? extends T> components) {
- requireNonNull(id, "id must be non-null.");
- requireNonNull(components, "components must be non-null");
-
- this.components = ImmutableList.copyOf(components);
- this.id = id;
- }
-
- public String id() {
- return id;
- }
-
- public boolean isEmpty() {
- return components.isEmpty();
- }
-
- @Override
- public Iterator<T> iterator() {
- return components.iterator();
- }
-
- @Override
- public String toString() {
- StringBuilder b = new StringBuilder();
- b.append("chain '").append(id).append("'{");
- boolean first = true;
- for (T component : components) {
- if (!first) {
- b.append("->");
- } else {
- first = false;
- }
- b.append(" ").append(component.getClass().getSimpleName()).append(" ");
- }
- b.append("}");
- return b.toString();
- }
-
- @Override
- public int hashCode() {
- return id.hashCode();
- }
-
- @Override
- public boolean equals(Object other) {
- return other instanceof Chain && equals((Chain<?>)other);
- }
-
- public boolean equals(Chain<?> other) {
- return id.equals(other.id) && componentsIdentical(components, other.components);
- }
-
- private boolean componentsIdentical(Collection<T> components1, Collection<?> components2) {
- if (components1.size() != components2.size()) {
- return false;
- }
- Iterator<T> iterator1 = components1.iterator();
- Iterator<?> iterator2 = components2.iterator();
- while (iterator1.hasNext()) {
- T c1 = iterator1.next();
- Object c2 = iterator2.next();
-
- if (c1 != c2) {
- return false;
- }
- }
- return true;
- }
-
-}
diff --git a/yolean/src/main/java/com/yahoo/yolean/chain/ChainBuilder.java b/yolean/src/main/java/com/yahoo/yolean/chain/ChainBuilder.java
deleted file mode 100644
index cb79c05ddab..00000000000
--- a/yolean/src/main/java/com/yahoo/yolean/chain/ChainBuilder.java
+++ /dev/null
@@ -1,250 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.yolean.chain;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.IdentityHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * @author Tony Vaagenes
- * @author gjoranv
- * @deprecated Will be removed in Vespa 8 with no replacement.
- */
-@Deprecated
-public final class ChainBuilder<T> {
-
- private final String chainId;
- private final List<T> components = new ArrayList<>();
- private final IdentityHashMap<T, Dependencies<T>> dependencies = new IdentityHashMap<>();
-
- public ChainBuilder(String chainId) {
- this.chainId = chainId;
- }
-
- @SafeVarargs
- @SuppressWarnings("varargs")
- public final ChainBuilder<T> add(T component, Dependencies<? extends T>... dependenciesList) {
- if (dependencies.containsKey(component)) {
- throw new IllegalArgumentException("The same component cannot be added twice: " + component);
- }
- components.add(component);
-
- List<Dependencies<? extends T>> allDependencies =
- Dependencies.allOf(dependenciesList, Dependencies.getAnnotatedDependencies(component));
- dependencies.put(component, Dependencies.union(allDependencies));
-
- return this;
- }
-
- public Chain<T> build() {
- DirectedGraph graph = buildGraph();
- List<Vertex> sortedVertices = graph.topologicalSort();
- return new Chain<>(chainId, components(sortedVertices));
- }
-
- private DirectedGraph buildGraph() {
- DirectedGraph graph = new DirectedGraph();
- List<ComponentVertex<T>> vertices = createVertices();
-
- addVertices(graph, vertices);
- addEdges(graph, vertices, dependencies);
-
- return graph;
- }
-
- private List<ComponentVertex<T>> createVertices() {
- List<ComponentVertex<T>> vertices = new ArrayList<>();
- for (T component : components) {
- vertices.add(new ComponentVertex<>(component));
- }
- return vertices;
- }
-
- @SuppressWarnings("unchecked")
- private List<T> components(List<Vertex> sortedVertices) {
- List<T> result = new ArrayList<>();
- for (Vertex vertex : sortedVertices) {
- if (vertex instanceof ComponentVertex) {
- result.add((T)((ComponentVertex)vertex).component);
- }
- }
- return result;
- }
-
- // TODO: create subclasses Beginning/EdingVertex instead? We could then create the correct class in createVertices,
- // TODO: and call the same method in DirGraph for all types.
- private void addVertices(DirectedGraph graph, List<ComponentVertex<T>> vertices) {
- for (ComponentVertex<T> v : vertices) {
- if (isBeginningVertex(v)) {
- graph.addBeginningVertex(v);
- } else if (isEndingVertex(v)) {
- graph.addEndingVertex(v);
- } else {
- graph.addVertex(v);
- }
- }
- }
-
- private boolean isBeginningVertex(ComponentVertex<T> v) {
- return dependencies.get(v.component).before.providedNames.contains("*");
- }
-
- private boolean isEndingVertex(ComponentVertex<T> v) {
- return dependencies.get(v.component).after.providedNames.contains("*");
- }
-
- private static <T> void addEdges(DirectedGraph graph,
- List<ComponentVertex<T>> vertices,
- IdentityHashMap<T, Dependencies<T>> dependencies) {
- addBeforeInstanceEdges(graph, vertices, dependencies);
- addAfterInstanceEdges(graph, vertices, dependencies);
- addBeforeClassEdges(graph, vertices, dependencies);
- addAfterClassEdges(graph, vertices, dependencies);
- addBeforeProvidedEdges(graph, vertices, dependencies);
- addAfterProvidedEdges(graph, vertices, dependencies);
- }
-
- // NOTE: When reading 'beforeVertex' below, think that 'vertex' should be _before_ beforeVertex.
-
- private static <T> void addBeforeClassEdges(DirectedGraph graph,
- List<ComponentVertex<T>> vertices,
- IdentityHashMap<T, Dependencies<T>> dependencies) {
- for (ComponentVertex<T> vertex : vertices) {
- for (Class<? extends T> beforeClass : dependencies.get(vertex.component).before.classes) {
- for (Vertex beforeVertex : componentsWithClass(vertices, beforeClass)) {
- graph.addEdge(vertex, beforeVertex);
- }
- }
- }
- }
-
- private static <T> void addAfterClassEdges(DirectedGraph graph,
- List<ComponentVertex<T>> vertices,
- IdentityHashMap<T, Dependencies<T>> dependencies) {
- for (ComponentVertex<T> vertex : vertices) {
- for (Class<? extends T> afterClass : dependencies.get(vertex.component).after.classes) {
- for (Vertex afterVertex : componentsWithClass(vertices, afterClass)) {
- graph.addEdge(afterVertex, vertex);
- }
- }
- }
- }
-
- private static <T> List<Vertex> componentsWithClass(List<ComponentVertex<T>> vertices,
- Class<? extends T> beforeClass) {
- List<Vertex> result = new ArrayList<>();
- for (ComponentVertex<T> vertex : vertices) {
- if (beforeClass.isInstance(vertex.component)) {
- result.add(vertex);
- }
- }
- return result;
- }
-
- private static <T> void addBeforeInstanceEdges(DirectedGraph graph,
- List<ComponentVertex<T>> vertices,
- IdentityHashMap<T, Dependencies<T>> dependencies) {
- IdentityHashMap<T, Vertex> componentToVertex = getComponentToVertex(vertices);
- for (ComponentVertex<T> vertex : vertices) {
- for (T before : dependencies.get(vertex.component).before.instances) {
- Vertex beforeVertex = componentToVertex.get(before);
- if (beforeVertex != null) {
- graph.addEdge(vertex, beforeVertex);
- }
- }
- }
- }
-
- private static <T> void addAfterInstanceEdges(DirectedGraph graph,
- List<ComponentVertex<T>> vertices,
- IdentityHashMap<T, Dependencies<T>> dependencies) {
- IdentityHashMap<T, Vertex> componentToVertex = getComponentToVertex(vertices);
- for (ComponentVertex<T> vertex : vertices) {
- for (T after : dependencies.get(vertex.component).after.instances) {
- Vertex afterVertex = componentToVertex.get(after);
- if (afterVertex != null) {
- graph.addEdge(afterVertex, vertex);
- }
- }
- }
- }
-
- private static <T> IdentityHashMap<T, Vertex> getComponentToVertex(List<ComponentVertex<T>> vertices) {
- IdentityHashMap<T, Vertex> result = new IdentityHashMap<>();
- for (ComponentVertex<T> vertex : vertices) {
- result.put(vertex.component, vertex);
- }
- return result;
- }
-
- private static <T> void addBeforeProvidedEdges(DirectedGraph graph,
- List<ComponentVertex<T>> vertices,
- IdentityHashMap<T, Dependencies<T>> dependencies) {
- Map<String, Set<Vertex>> providedNames = getProvidedNames(vertices, dependencies);
- for (ComponentVertex<T> vertex : vertices) {
- for (String name : dependencies.get(vertex.component).before.providedNames) {
- for (Vertex beforeVertex : emptyIfNull(providedNames.get(name))) {
- graph.addEdge(vertex, beforeVertex);
- }
- }
- }
- }
-
- private static <T> void addAfterProvidedEdges(DirectedGraph graph,
- List<ComponentVertex<T>> vertices,
- IdentityHashMap<T, Dependencies<T>> dependencies) {
- Map<String, Set<Vertex>> providedNames = getProvidedNames(vertices, dependencies);
- for (ComponentVertex<T> vertex : vertices) {
- for (String name : dependencies.get(vertex.component).after.providedNames) {
- for (Vertex afterVertex : emptyIfNull(providedNames.get(name))) {
- graph.addEdge(afterVertex, vertex);
- }
- }
- }
- }
-
- private static <T> Map<String, Set<Vertex>> getProvidedNames(List<ComponentVertex<T>> vertices,
- IdentityHashMap<T, Dependencies<T>> dependencies) {
- Map<String, Set<Vertex>> result = new HashMap<>();
- for (ComponentVertex<T> vertex : vertices) {
- for (String providedName : dependencies.get(vertex.component).provided) {
- getIdentitySet(result, providedName).add(vertex);
- }
- addClassName(result, vertex);
- }
- return result;
- }
-
- private static void addClassName(Map<String, Set<Vertex>> providedNamesToVertex, ComponentVertex<?> vertex) {
- String className = vertex.component.getClass().getName();
- getIdentitySet(providedNamesToVertex, className).add(vertex);
- }
-
- private static <T> Set<T> getIdentitySet(Map<String, Set<T>> map, String key) {
- Set<T> result = map.get(key);
- if (result == null) {
- result = Collections.newSetFromMap(new IdentityHashMap<T, Boolean>());
- map.put(key, result);
- }
- return result;
- }
-
- private static <T> Set<T> emptyIfNull(Set<T> set) {
- return set != null ?
- set :
- Collections.<T>emptySet();
- }
-
- private static class ComponentVertex<T> implements Vertex {
-
- final T component;
-
- private ComponentVertex(T component) {
- this.component = component;
- }
- }
-}
diff --git a/yolean/src/main/java/com/yahoo/yolean/chain/ChainCycleException.java b/yolean/src/main/java/com/yahoo/yolean/chain/ChainCycleException.java
deleted file mode 100644
index 6d8e14d696d..00000000000
--- a/yolean/src/main/java/com/yahoo/yolean/chain/ChainCycleException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.yolean.chain;
-
-import com.google.common.collect.ImmutableList;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author Tony Vaagenes
- * @deprecated Will be removed in Vespa 8 with no replacement.
- */
-@Deprecated
-public class ChainCycleException extends RuntimeException {
-
- private final List<?> components;
-
- public ChainCycleException(List<?> components) {
- this.components = ImmutableList.copyOf(components);
- }
-
- public List<?> components() {
- return components;
- }
-
-}
diff --git a/yolean/src/main/java/com/yahoo/yolean/chain/Dependencies.java b/yolean/src/main/java/com/yahoo/yolean/chain/Dependencies.java
deleted file mode 100644
index 57f74190aff..00000000000
--- a/yolean/src/main/java/com/yahoo/yolean/chain/Dependencies.java
+++ /dev/null
@@ -1,194 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.yolean.chain;
-
-import java.lang.annotation.Annotation;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.List;
-
-/**
- * @author Tony Vaagenes
- * @author gjoranv
- * @deprecated Will be removed in Vespa 8 with no replacement.
- */
-@Deprecated
-public class Dependencies<T> {
-
- final Order<T> before;
- final Order<T> after;
- final List<String> provided;
-
- private Dependencies(Order<T> before, Order<T> after, String[] provided) {
- this.before = before;
- this.after = after;
- this.provided = copyList(provided);
- }
-
- @SafeVarargs
- @SuppressWarnings("varargs")
- public static <T> Dependencies<T> before(T... components) {
- return new Dependencies<>(new Order<>(components, null, null), Order.<T>emptyOrder(), null);
- }
-
- @SafeVarargs
- @SuppressWarnings("varargs")
- public static <T> Dependencies<T> before(Class<? extends T>... classes) {
- return new Dependencies<>(new Order<>(null, classes, null), Order.<T>emptyOrder(), null);
- }
-
- public static <T> Dependencies<T> before(String... providedNames) {
- return new Dependencies<>(new Order<T>(null, null, providedNames), Order.<T>emptyOrder(), null);
- }
-
- @SafeVarargs
- @SuppressWarnings("varargs")
- public static <T> Dependencies<T> after(T... components) {
- return new Dependencies<>(Order.<T>emptyOrder(), new Order<>(components, null, null), null);
- }
-
- @SafeVarargs
- @SuppressWarnings("varargs")
- public static <T> Dependencies<T> after(Class<? extends T>... classes) {
- return new Dependencies<>(Order.<T>emptyOrder(), new Order<>(null, classes, null), null);
- }
-
- public static <T> Dependencies<T> after(String... providedNames) {
- return new Dependencies<>(Order.<T>emptyOrder(), new Order<T>(null, null, providedNames), null);
- }
-
- public static <T> Dependencies<T> provides(String... names) {
- return new Dependencies<>(Order.<T>emptyOrder(), Order.<T>emptyOrder(), names);
- }
-
- public static <T> Dependencies<T> emptyDependencies() {
- return new Dependencies<>(Order.<T>emptyOrder(), Order.<T>emptyOrder(), null);
- }
-
- @SuppressWarnings("unchecked")
- static <T> Dependencies<T> union(List<Dependencies<? extends T>> dependenciesList) {
- if (dependenciesList.size() > 1) {
- Dependencies<T> result = emptyDependencies();
- for (Dependencies<? extends T> dependencies : dependenciesList) {
- result = result.union(dependencies);
- }
- return result;
- } else if (dependenciesList.size() == 0) {
- return emptyDependencies();
- } else {
- return (Dependencies<T>)dependenciesList.get(0); // Dependencies<T> is covariant for T, the cast is valid.
- }
- }
-
- private Dependencies<T> union(Dependencies<? extends T> other) {
- List<String> lst = listUnion(provided, other.provided);
- return new Dependencies<>(before.union(other.before),
- after.union(other.after),
- lst.toArray(new String[lst.size()]));
- }
-
- private static <T> List<T> listUnion(List<? extends T> list1, List<? extends T> list2) {
- List<T> union = new ArrayList<>(list1);
- union.removeAll(list2);
- union.addAll(list2);
- return union;
- }
-
- static <T> Dependencies<T> getAnnotatedDependencies(T component) {
- return new Dependencies<>(
- new Order<T>(null, null, getSymbols(component, Before.class)),
- new Order<T>(null, null, getSymbols(component, After.class)),
- getProvidedSymbols(component));
- }
-
- private static <T> String[] getProvidedSymbols(T component) {
- List<String> lst = allOf(getSymbols(component, Provides.class), component.getClass().getName());
- return lst.toArray(new String[lst.size()]);
- }
-
- @SafeVarargs
- @SuppressWarnings("varargs")
- static <T> List<T> allOf(List<T> elements, T... otherElements) {
- List<T> result = new ArrayList<>(elements);
- result.addAll(Arrays.asList(otherElements));
- return result;
- }
-
- @SafeVarargs
- @SuppressWarnings("varargs")
- static <T> List<T> allOf(T[] elements, T... otherElements) {
- return allOf(Arrays.asList(elements), otherElements);
- }
-
- private static <T> List<String> getSymbols(T component, Class<? extends Annotation> annotationClass) {
- List<String> result = new ArrayList<>();
-
- result.addAll(annotationSymbols(component, annotationClass));
- return result;
- }
-
- private static <T> Collection<String> annotationSymbols(T component, Class<? extends Annotation> annotationClass) {
- try {
- List<String> values = new ArrayList<>();
-
- Class<?> clazz = component.getClass();
- while (clazz != null) {
- Annotation annotation = clazz.getAnnotation(annotationClass);
- if (annotation != null) {
- values.addAll(Arrays.asList((String[])annotationClass.getMethod("value").invoke(annotation)));
- }
- clazz = clazz.getSuperclass();
- }
- return values;
- } catch (IllegalAccessException | NoSuchMethodException | InvocationTargetException e) {
- throw new RuntimeException(e);
- }
- }
-
- private static <U> List<U> copyList(List<U> list) {
- return list == null ?
- Collections.<U>emptyList() :
- new ArrayList<>(list);
- }
-
- private static <U> List<U> copyList(U[] array) {
- return array == null ?
- Collections.<U>emptyList() :
- new ArrayList<>(Arrays.<U>asList(array));
- }
-
- static final class Order<T> {
-
- final List<T> instances;
- final List<Class<? extends T>> classes;
- final List<String> providedNames;
-
- private Order(T[] instances, Class<? extends T>[] classes, String[] providedNames) {
- this.instances = copyList(instances);
- this.classes = copyList(classes);
- this.providedNames = copyList(providedNames);
- }
-
- private Order(List<T> instances, List<Class<? extends T>> classes, List<String> providedNames) {
- this.instances = copyList(instances);
- this.classes = copyList(classes);
- this.providedNames = copyList(providedNames);
- }
-
- // TODO: unit test
- private Order<T> union(Order<? extends T> other) {
- return new Order<>(
- listUnion(instances, other.instances),
- listUnion(classes, other.classes),
- listUnion(providedNames, other.providedNames));
- }
-
- // TODO: try to make it possible to use 'null' Order in Dependencies instead.
- private static <U> Order<U> emptyOrder() {
- return new Order<>((U[])null, null, null);
- }
- }
-
-}
diff --git a/yolean/src/main/java/com/yahoo/yolean/chain/DirectedGraph.java b/yolean/src/main/java/com/yahoo/yolean/chain/DirectedGraph.java
deleted file mode 100644
index 0a481042af4..00000000000
--- a/yolean/src/main/java/com/yahoo/yolean/chain/DirectedGraph.java
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.yolean.chain;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.IdentityHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * TODO: prioritize vertices in edge map.
- *
- * @author Tony Vaagenes
- */
-@Deprecated
-class DirectedGraph {
-
- private IdentityHashMap<Vertex, List<Vertex>> incommingEdges = new IdentityHashMap<>();
- private List<Vertex> vertices = new ArrayList<>();
- private List<Vertex> beginningVertices = new ArrayList<>();
- private List<Vertex> endingVertices = new ArrayList<>();
-
- public void addVertex(Vertex vertex) {
- vertices.add(vertex);
- }
-
- public void addBeginningVertex(Vertex vertex) {
- beginningVertices.add(vertex);
- }
-
- public void addEndingVertex(Vertex vertex) {
- endingVertices.add(vertex);
- }
-
- public void addEdge(Vertex start, Vertex end) {
- get(incommingEdges, end).add(start);
- }
-
- private static List<Vertex> get(Map<Vertex, List<Vertex>> edgeMap, Vertex key) {
- List<Vertex> value = edgeMap.get(key);
- return value == null ?
- addEmptyList(edgeMap, key) :
- value;
- }
-
- private static List<Vertex> addEmptyList(Map<Vertex, List<Vertex>> edgeMap, Vertex key) {
- List<Vertex> value = new ArrayList<>();
- edgeMap.put(key, value);
- return value;
- }
-
- public List<Vertex> topologicalSort() {
- EnumeratedIdentitySet<Vertex> visitedVertices = new EnumeratedIdentitySet<>();
-
- for (Vertex v : beginningVertices) {
- topologicalSortVisit(v, visitedVertices);
- }
-
- warnIfVisitedEndVertices(visitedVertices);
-
- for (Vertex v : vertices) {
- topologicalSortVisit(v, visitedVertices);
- }
-
- // TODO: review this!
- for (Vertex v : endingVertices) {
- topologicalSortVisit(v, visitedVertices);
- }
-
- return visitedVertices.insertionOrderedList();
- }
-
- private void warnIfVisitedEndVertices(EnumeratedIdentitySet<Vertex> visitedVertices) {
- //TVT:
- }
-
- private void topologicalSortVisit(Vertex vertex, Set<Vertex> visitedVertices) {
- topologicalSortVisitImpl(vertex, visitedVertices, new EnumeratedIdentitySet<Vertex>());
- }
-
- private void topologicalSortVisitImpl(Vertex vertex, Set<Vertex> visitedVertices,
- EnumeratedIdentitySet<Vertex> cycleDetector) {
- if (cycleDetector.contains(vertex)) {
- throw new ChainCycleException(cycleDetector.insertionOrderedList());
- }
-
- if (visitedVertices.contains(vertex)) {
- return;
- }
-
- cycleDetector.add(vertex);
-
- for (Vertex endVertex : emptyIfNull(incommingEdges.get(vertex))) {
- topologicalSortVisitImpl(endVertex, visitedVertices, cycleDetector);
- }
-
- visitedVertices.add(vertex);
- cycleDetector.remove(vertex);
- }
-
- private <T> List<T> emptyIfNull(List<T> list) {
- return list == null ?
- Collections.<T>emptyList() :
- list;
- }
-
-}
diff --git a/yolean/src/main/java/com/yahoo/yolean/chain/EnumeratedIdentitySet.java b/yolean/src/main/java/com/yahoo/yolean/chain/EnumeratedIdentitySet.java
deleted file mode 100644
index 220696e6c5f..00000000000
--- a/yolean/src/main/java/com/yahoo/yolean/chain/EnumeratedIdentitySet.java
+++ /dev/null
@@ -1,185 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.yolean.chain;
-
-import java.lang.reflect.Array;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.IdentityHashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedMap;
-import java.util.TreeMap;
-
-/**
- * A set using identity comparison.
- * Keeps track of insertion order, which is available by calling insertionOrderedList.
- *
- * @author Tony Vaagenes
- */
-@Deprecated
-class EnumeratedIdentitySet<T> implements Set<T> {
-
- private int counter = 0;
- private final Map<T, Integer> set = new IdentityHashMap<>();
-
- public EnumeratedIdentitySet(Collection<? extends T> collection) {
- addAll(collection);
- }
-
- public EnumeratedIdentitySet() {
- // empty
- }
-
- @Override
- public int size() {
- return set.size();
- }
-
- @Override
- public boolean isEmpty() {
- return set.isEmpty();
- }
-
- @Override
- public boolean contains(Object o) {
- return set.containsKey(o);
- }
-
- @Override
- public Iterator<T> iterator() {
- return set.keySet().iterator();
- }
-
- @Override
- public Object[] toArray() {
- return set.keySet().toArray();
- }
-
- @Override
- public <T1> T1[] toArray(T1[] a) {
- return set.keySet().toArray(a);
- }
-
- @Override
- public boolean add(T t) {
- if (set.containsKey(t)) {
- return false;
- } else {
- set.put(t, counter++);
- return true;
- }
- }
-
- @Override
- public boolean remove(Object o) {
- return set.remove(o) != null;
- }
-
- @Override
- public boolean containsAll(Collection<?> c) {
- return set.keySet().containsAll(c);
- }
-
- @Override
- public boolean addAll(Collection<? extends T> collection) {
- boolean changed = false;
-
- for (T t : collection) {
- changed |= add(t);
- }
-
- return changed;
- }
-
- @Override
- public boolean retainAll(Collection<?> collection) {
- return set.keySet().retainAll(collection);
- }
-
- @Override
- public boolean removeAll(Collection<?> collection) {
- boolean changed = false;
-
- for (Object o : collection) {
- changed |= remove(o);
- }
-
- return changed;
- }
-
- @Override
- public void clear() {
- set.clear();
- counter = 0;
- }
-
- public List<T> insertionOrderedList() {
- if (set.isEmpty()) {
- counter = 0;
- return Collections.emptyList();
- }
-
- if (counter >= set.size() * 2 + 20) {
- renumber();
- }
-
- return getKeysSortedByValue(set, counter);
- }
-
- private static <KEY> List<KEY> getKeysSortedByValue(Map<KEY, Integer> set, int maxValue) {
- @SuppressWarnings("unchecked")
- KEY[] result = (KEY[])Array.newInstance(headKey(set).getClass(), maxValue);
-
- for (Map.Entry<KEY, Integer> entry : set.entrySet()) {
- result[entry.getValue()] = entry.getKey();
- }
-
- return removeNulls(result);
- }
-
- private static <T> T headKey(Map<T, ?> map) {
- return map.entrySet().iterator().next().getKey();
- }
-
- static <T> List<T> removeNulls(T[] list) {
- int insertionSpot = 0;
- for (int i = 0; i < list.length; i++) {
- T element = list[i];
- if (element != null) {
- list[insertionSpot] = element;
- insertionSpot++;
- }
- }
- return Arrays.asList(list).subList(0, insertionSpot);
- }
-
- //only for testing
- List<Integer> numbers() {
- return new ArrayList<>(set.values());
- }
-
- private void renumber() {
- SortedMap<Integer, T> invertedSet = invertedSortedMap(set);
-
- int i = 0;
- for (Map.Entry<Integer, T> entry : invertedSet.entrySet()) {
- set.put(entry.getValue(), i++);
- }
- counter = i;
- }
-
- private static <K, V> SortedMap<V, K> invertedSortedMap(Map<K, V> map) {
- SortedMap<V, K> result = new TreeMap<>();
-
- for (Map.Entry<K, V> entry : map.entrySet()) {
- result.put(entry.getValue(), entry.getKey());
- }
-
- return result;
- }
-
-}
diff --git a/yolean/src/main/java/com/yahoo/yolean/chain/Vertex.java b/yolean/src/main/java/com/yahoo/yolean/chain/Vertex.java
deleted file mode 100644
index 5a506406ebf..00000000000
--- a/yolean/src/main/java/com/yahoo/yolean/chain/Vertex.java
+++ /dev/null
@@ -1,10 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.yolean.chain;
-
-/**
- * @author Tony Vaagenes
- */
-@Deprecated
-interface Vertex {
-
-}
diff --git a/yolean/src/main/java/com/yahoo/yolean/concurrent/ConcurrentResourcePool.java b/yolean/src/main/java/com/yahoo/yolean/concurrent/ConcurrentResourcePool.java
index bdd059f3e17..0e91a44bf5d 100644
--- a/yolean/src/main/java/com/yahoo/yolean/concurrent/ConcurrentResourcePool.java
+++ b/yolean/src/main/java/com/yahoo/yolean/concurrent/ConcurrentResourcePool.java
@@ -18,12 +18,6 @@ public class ConcurrentResourcePool<T> implements Iterable<T> {
private final Queue<T> pool = new ConcurrentLinkedQueue<>();
private final Supplier<T> factory;
- /** @deprecated Use {@link ConcurrentResourcePool(Supplier)} instead */
- @Deprecated(forRemoval = true, since = "7")
- @SuppressWarnings("removal")
- public ConcurrentResourcePool(ResourceFactory<T> factory) {
- this.factory = factory.asSupplier();
- }
public ConcurrentResourcePool(Supplier<T> factory) {
this.factory = factory;
diff --git a/yolean/src/main/java/com/yahoo/yolean/concurrent/ResourceFactory.java b/yolean/src/main/java/com/yahoo/yolean/concurrent/ResourceFactory.java
deleted file mode 100644
index cc9acf69684..00000000000
--- a/yolean/src/main/java/com/yahoo/yolean/concurrent/ResourceFactory.java
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-package com.yahoo.yolean.concurrent;
-
-import java.util.function.Supplier;
-
-/**
- * @author baldersheim
- */
-@Deprecated(forRemoval = true, since = "7")
-public abstract class ResourceFactory<T> {
-
- public abstract T create();
-
- public final Supplier<T> asSupplier() {
- return () -> create();
- }
-
-}
diff --git a/yolean/src/main/java/com/yahoo/yolean/concurrent/ResourcePool.java b/yolean/src/main/java/com/yahoo/yolean/concurrent/ResourcePool.java
index 895fa890beb..ffc761ad625 100644
--- a/yolean/src/main/java/com/yahoo/yolean/concurrent/ResourcePool.java
+++ b/yolean/src/main/java/com/yahoo/yolean/concurrent/ResourcePool.java
@@ -18,12 +18,6 @@ public final class ResourcePool<T> implements Iterable<T> {
private final Deque<T> pool = new ArrayDeque<>();
private final Supplier<T> factory;
- /** @deprecated Use {@link ResourcePool( Supplier )} instead */
- @Deprecated(forRemoval = true, since = "7")
- @SuppressWarnings("removal")
- public ResourcePool(ResourceFactory<T> factory) {
- this(factory.asSupplier());
- }
public ResourcePool(Supplier<T> factory) {
this.factory = factory;