Merge pull request #42503 from izeye

* pr/42503:
  Polish

Closes gh-42503
This commit is contained in:
Stéphane Nicoll
2024-10-03 08:15:40 +02:00
6 changed files with 15 additions and 15 deletions

View File

@@ -99,8 +99,8 @@ public class OpenTelemetryEventPublisherBeansApplicationListener implements Gene
/**
* {@link ContextStorage#addWrapper(java.util.function.Function) Add} the
* {@link ContextStorage} wrapper to ensure that {@link EventPublisher} are propagated
* correctly.
* {@link ContextStorage} wrapper to ensure that {@link EventPublisher
* EventPublishers} are propagated correctly.
*/
public static void addWrapper() {
if (isInstallable() && added.compareAndSet(false, true)) {
@@ -118,7 +118,7 @@ public class OpenTelemetryEventPublisherBeansApplicationListener implements Gene
*/
static final class Wrapper {
static Wrapper instance = new Wrapper();
static final Wrapper instance = new Wrapper();
private final MultiValueMap<ApplicationContext, EventPublishingContextWrapper> beans = new LinkedMultiValueMap<>();
@@ -149,13 +149,16 @@ public class OpenTelemetryEventPublisherBeansApplicationListener implements Gene
ContextStorage delegate = this.storageDelegate;
if (delegate == null) {
synchronized (this) {
delegate = parent;
for (List<EventPublishingContextWrapper> publishers : this.beans.values()) {
for (EventPublishingContextWrapper publisher : publishers) {
delegate = publisher.apply(delegate);
delegate = this.storageDelegate;
if (delegate == null) {
delegate = parent;
for (List<EventPublishingContextWrapper> publishers : this.beans.values()) {
for (EventPublishingContextWrapper publisher : publishers) {
delegate = publisher.apply(delegate);
}
}
this.storageDelegate = delegate;
}
this.storageDelegate = delegate;
}
}
return delegate;

View File

@@ -57,7 +57,6 @@ class BaggagePropagationIntegrationTests {
@BeforeEach
@AfterEach
void setup() {
OpenTelemetryEventPublisherBeansApplicationListener.addWrapper();
MDC.clear();
}

View File

@@ -58,8 +58,7 @@ class DataLdapTestDockerTests {
void connectionCanBeMadeToLdapContainer() {
List<String> cn = this.ldapTemplate.search(LdapQueryBuilder.query().where("objectclass").is("dcObject"),
(AttributesMapper<String>) (attributes) -> attributes.get("dc").get().toString());
assertThat(cn).hasSize(1);
assertThat(cn.get(0)).isEqualTo("example");
assertThat(cn).singleElement().isEqualTo("example");
}
@Test

View File

@@ -56,8 +56,7 @@ class OpenLdapContainerConnectionDetailsFactoryIntegrationTests {
void connectionCanBeMadeToLdapContainer() {
List<String> cn = this.ldapTemplate.search(LdapQueryBuilder.query().where("objectclass").is("dcObject"),
(AttributesMapper<String>) (attributes) -> attributes.get("dc").get().toString());
assertThat(cn).hasSize(1);
assertThat(cn.get(0)).isEqualTo("example");
assertThat(cn).singleElement().isEqualTo("example");
}
@Configuration(proxyBeanMethods = false)

View File

@@ -117,7 +117,7 @@ public abstract class ContainerConnectionDetailsFactory<C extends Container<?>,
}
/**
* Return if the give source accepts the connection. By default this method checks
* Return if the given source accepts the connection. By default this method checks
* each connection name.
* @param source the container connection source
* @param requiredContainerType the required container type

View File

@@ -95,7 +95,7 @@ public final class ContainerConnectionSource<C extends Container<?>> implements
}
/**
* Return is this source accepts the given connection.
* Return if this source accepts the given connection.
* @param requiredConnectionName the required connection name or {@code null}
* @param requiredContainerType the required container type
* @param requiredConnectionDetailsType the required connection details type