Skip to content

Commit

Permalink
Merge pull request #42503 from izeye
Browse files Browse the repository at this point in the history
* pr/42503:
  Polish

Closes gh-42503
  • Loading branch information
snicoll committed Oct 3, 2024
2 parents f29d492 + 1585c5a commit f5934f8
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public void onApplicationEvent(ApplicationEvent event) {

/**
* {@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)) {
Expand All @@ -118,7 +118,7 @@ private static boolean isInstallable() {
*/
static final class Wrapper {

static Wrapper instance = new Wrapper();
static final Wrapper instance = new Wrapper();

private final MultiValueMap<ApplicationContext, EventPublishingContextWrapper> beans = new LinkedMultiValueMap<>();

Expand Down Expand Up @@ -149,13 +149,16 @@ ContextStorage getStorageDelegate(ContextStorage parent) {
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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ class BaggagePropagationIntegrationTests {
@BeforeEach
@AfterEach
void setup() {
OpenTelemetryEventPublisherBeansApplicationListener.addWrapper();
MDC.clear();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public final D getConnectionDetails(ContainerConnectionSource<C> source) {
}

/**
* 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ private static String getOrDeduceConnectionName(String connectionName, String co
}

/**
* 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
Expand Down

0 comments on commit f5934f8

Please sign in to comment.