Skip to content

Commit 43a52d9

Browse files
authored
PHOENIX-7430 Remove commons-collections dependency in queryserver (#163)
- Also remove imports and replace with equivalent code
1 parent 405355f commit 43a52d9

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

phoenix-queryserver/pom.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,6 @@
215215
<groupId>org.slf4j</groupId>
216216
<artifactId>slf4j-api</artifactId>
217217
</dependency>
218-
<dependency>
219-
<groupId>commons-collections</groupId>
220-
<artifactId>commons-collections</artifactId>
221-
</dependency>
222218
<dependency>
223219
<groupId>com.google.code.findbugs</groupId>
224220
<artifactId>jsr305</artifactId>

phoenix-queryserver/src/main/java/org/apache/phoenix/util/InstanceResolver.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
*/
1818
package org.apache.phoenix.util;
1919

20-
import org.apache.commons.collections.IteratorUtils;
21-
20+
import java.util.ArrayList;
2221
import java.util.Iterator;
2322
import java.util.List;
2423
import java.util.ServiceLoader;
@@ -68,10 +67,13 @@ public static <T> T getSingleton(Class<T> clazz, T defaultInstance) {
6867
@SuppressWarnings("unchecked")
6968
public static <T> List get(Class<T> clazz, List<T> defaultInstances) {
7069
Iterator<T> iterator = ServiceLoader.load(clazz).iterator();
70+
List<T> instances = new ArrayList<>();
71+
iterator.forEachRemaining(instances::add);
72+
7173
if (defaultInstances != null) {
72-
defaultInstances.addAll(IteratorUtils.toList(iterator));
74+
defaultInstances.addAll(instances);
7375
} else {
74-
defaultInstances = IteratorUtils.toList(iterator);
76+
defaultInstances = instances;
7577
}
7678

7779
return defaultInstances;

pom.xml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@
8585
<jetty.version>9.4.53.v20231009</jetty.version>
8686
<netty-bom.version>4.1.108.Final</netty-bom.version>
8787
<commons-io.version>2.14.0</commons-io.version>
88-
<commons-collections.version>3.2.2</commons-collections.version>
8988
<sqlline.version>1.9.0</sqlline.version>
9089
<slf4j.version>1.7.36</slf4j.version>
9190
<avatica.version>1.25.0</avatica.version>
@@ -729,12 +728,6 @@
729728
</exclusion>
730729
</exclusions>
731730
</dependency>
732-
733-
<dependency>
734-
<groupId>commons-collections</groupId>
735-
<artifactId>commons-collections</artifactId>
736-
<version>${commons-collections.version}</version>
737-
</dependency>
738731
<dependency>
739732
<groupId>org.apache.calcite.avatica</groupId>
740733
<artifactId>avatica</artifactId>

0 commit comments

Comments
 (0)