Skip to content

Commit

Permalink
Merge branch 'main' of github.com:microsoft/gctoolkit
Browse files Browse the repository at this point in the history
  • Loading branch information
kcpeppe committed Apr 20, 2022
2 parents 99f423c + 5d7646d commit c478a62
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 14 deletions.
4 changes: 2 additions & 2 deletions IT/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.microsoft.gctoolkit</groupId>
<artifactId>gctoolkit</artifactId>
<version>2.0.9-SNAPSHOT</version>
<version>2.0.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down Expand Up @@ -44,7 +44,7 @@
<dependency>
<groupId>com.microsoft.gctoolkit</groupId>
<artifactId>gctoolkit-sample</artifactId>
<version>2.0.9-SNAPSHOT</version>
<version>2.0.10-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.microsoft.gctoolkit</groupId>
<artifactId>gctoolkit</artifactId>
<version>2.0.9-SNAPSHOT</version>
<version>2.0.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion gclogs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.microsoft.gctoolkit</groupId>
<artifactId>gctoolkit</artifactId>
<version>2.0.9-SNAPSHOT</version>
<version>2.0.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion parser/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.microsoft.gctoolkit</groupId>
<artifactId>gctoolkit</artifactId>
<version>2.0.9-SNAPSHOT</version>
<version>2.0.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<groupId>com.microsoft.gctoolkit</groupId>
<artifactId>gctoolkit</artifactId>
<packaging>pom</packaging>
<version>2.0.9-SNAPSHOT</version>
<version>2.0.10-SNAPSHOT</version>

<name>GCToolKit</name>
<description>GC log parsing utilities</description>
Expand Down
2 changes: 1 addition & 1 deletion sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.microsoft.gctoolkit</groupId>
<artifactId>gctoolkit</artifactId>
<version>2.0.9-SNAPSHOT</version>
<version>2.0.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion vertx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.microsoft.gctoolkit</groupId>
<artifactId>gctoolkit</artifactId>
<version>2.0.9-SNAPSHOT</version>
<version>2.0.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.stream.Stream;

/* package-scope */ abstract class GCToolkitVertxParameters {

Expand Down Expand Up @@ -75,12 +76,15 @@ private static Aggregator<?> createAggregator(
Class<? extends Aggregator<?>> aggregatorClass,
Class<? extends Aggregation> aggregationClass) {
try {
Constructor<?>[] constructors = aggregatorClass.getConstructors();
if (constructors.length == 0) {
LOGGER.log(Level.WARNING, aggregatorClass + " must have a public constructor which takes a " + Aggregation.class);
return null;
}
return (Aggregator<?>) aggregatorClass.getConstructors()[0].newInstance(aggregationClass.getConstructors()[0].newInstance());
Constructor<?>[] aggregatorCtors = aggregatorClass.getConstructors();
Constructor<?> aggregatorCtor = Stream.of(aggregatorCtors)
.filter(ctor -> ctor.getParameterTypes().length == 1)
.filter(ctor -> ctor.getParameterTypes()[0].isAssignableFrom(aggregationClass))
.findFirst()
.orElseThrow(() -> new NoSuchMethodException(aggregatorClass + " must have a public constructor which takes a " + Aggregation.class));
Constructor<? extends Aggregation> aggregationCtor = aggregationClass.getConstructor();
Aggregation aggregation = aggregationCtor.newInstance();
return (Aggregator<?>)aggregatorCtor.newInstance(aggregation);
} catch (ReflectiveOperationException e) {
LOGGER.log(Level.WARNING, e + ": Cannot construct instance of " + aggregatorClass);
}
Expand Down

0 comments on commit c478a62

Please sign in to comment.