pull/35935/head
Phillip Webb 1 year ago
parent fe927f0e06
commit 854b29b8fb

@ -18,7 +18,6 @@ package org.springframework.boot.actuate.autoconfigure.tracing;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import io.micrometer.tracing.SpanCustomizer;
import io.micrometer.tracing.exporter.SpanExportingPredicate;
@ -128,7 +127,7 @@ public class OpenTelemetryAutoConfiguration {
@Bean
@ConditionalOnMissingBean
SpanProcessors spanProcessors(ObjectProvider<SpanProcessor> spanProcessors) {
return SpanProcessors.of(spanProcessors.orderedStream().collect(Collectors.toList()));
return SpanProcessors.of(spanProcessors.orderedStream().toList());
}
@Bean
@ -145,7 +144,7 @@ public class OpenTelemetryAutoConfiguration {
@Bean
@ConditionalOnMissingBean
SpanExporters spanExporters(ObjectProvider<SpanExporter> spanExporters) {
return SpanExporters.of(spanExporters.orderedStream().collect(Collectors.toList()));
return SpanExporters.of(spanExporters.orderedStream().toList());
}
@Bean

@ -17,18 +17,22 @@
package org.springframework.boot.actuate.autoconfigure.tracing;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Spliterator;
import io.opentelemetry.sdk.trace.export.SpanExporter;
import org.springframework.util.Assert;
/**
* A collection of {@link SpanExporter span exporters}.
*
* @author Moritz Halbritter
* @since 3.2.0
*/
@FunctionalInterface
public interface SpanExporters extends Iterable<SpanExporter> {
/**
@ -47,16 +51,6 @@ public interface SpanExporters extends Iterable<SpanExporter> {
return list().spliterator();
}
/**
* Constructs a {@link SpanExporters} instance with the given list of
* {@link SpanExporter span exporters}.
* @param spanExporters the list of span exporters
* @return the constructed {@link SpanExporters} instance
*/
static SpanExporters of(List<SpanExporter> spanExporters) {
return () -> spanExporters;
}
/**
* Constructs a {@link SpanExporters} instance with the given {@link SpanExporter span
* exporters}.
@ -67,4 +61,16 @@ public interface SpanExporters extends Iterable<SpanExporter> {
return of(Arrays.asList(spanExporters));
}
/**
* Constructs a {@link SpanExporters} instance with the given list of
* {@link SpanExporter span exporters}.
* @param spanExporters the list of span exporters
* @return the constructed {@link SpanExporters} instance
*/
static SpanExporters of(Collection<? extends SpanExporter> spanExporters) {
Assert.notNull(spanExporters, "SpanExporters must not be null");
List<SpanExporter> copy = List.copyOf(spanExporters);
return () -> copy;
}
}

@ -17,18 +17,22 @@
package org.springframework.boot.actuate.autoconfigure.tracing;
import java.util.Arrays;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.Spliterator;
import io.opentelemetry.sdk.trace.SpanProcessor;
import org.springframework.util.Assert;
/**
* A collection of {@link SpanProcessor span processors}.
*
* @author Moritz Halbritter
* @since 3.2.0
*/
@FunctionalInterface
public interface SpanProcessors extends Iterable<SpanProcessor> {
/**
@ -47,16 +51,6 @@ public interface SpanProcessors extends Iterable<SpanProcessor> {
return list().spliterator();
}
/**
* Constructs a {@link SpanProcessors} instance with the given list of
* {@link SpanProcessor span processors}.
* @param spanProcessors the list of span processors
* @return the constructed {@link SpanProcessors} instance
*/
static SpanProcessors of(List<SpanProcessor> spanProcessors) {
return () -> spanProcessors;
}
/**
* Constructs a {@link SpanProcessors} instance with the given {@link SpanProcessor
* span processors}.
@ -67,4 +61,16 @@ public interface SpanProcessors extends Iterable<SpanProcessor> {
return of(Arrays.asList(spanProcessors));
}
/**
* Constructs a {@link SpanProcessors} instance with the given list of
* {@link SpanProcessor span processors}.
* @param spanProcessors the list of span processors
* @return the constructed {@link SpanProcessors} instance
*/
static SpanProcessors of(Collection<? extends SpanProcessor> spanProcessors) {
Assert.notNull(spanProcessors, "SpanProcessors must not be null");
List<SpanProcessor> copy = List.copyOf(spanProcessors);
return () -> copy;
}
}

@ -26,8 +26,9 @@ import org.eclipse.jetty.util.thread.ThreadPool;
import org.springframework.boot.autoconfigure.web.ServerProperties;
/**
* Creates a {@link ThreadPool} for Jetty, applying the
* {@link ServerProperties.Jetty.Threads} properties.
* Creates a {@link ThreadPool} for Jetty, applying
* {@link org.springframework.boot.autoconfigure.web.ServerProperties.Jetty.Threads
* ServerProperties.Jetty.Threads Jetty thread properties}.
*
* @author Moritz Halbritter
*/
@ -52,9 +53,7 @@ final class JettyThreadPool {
if (maxQueueCapacity == 0) {
return new SynchronousQueue<>();
}
else {
return new BlockingArrayQueue<>(maxQueueCapacity);
}
return new BlockingArrayQueue<>(maxQueueCapacity);
}
}

Loading…
Cancel
Save