mirror of
https://github.com/spring-projects/spring-data-elasticsearch.git
synced 2025-06-22 12:02:10 +00:00
Remove Blockhound
Original Pull Request #2978 Closes #2977 (cherry picked from commit d06c122fd55e55b8886b1d3a3389516b08066784) (cherry picked from commit 8117e5a174c6d1b4ad52995744368291acb5c191)
This commit is contained in:
parent
5a2dcd3b01
commit
1d5c78a06a
27
pom.xml
27
pom.xml
@ -23,7 +23,6 @@
|
|||||||
<!-- version of the ElasticsearchClient -->
|
<!-- version of the ElasticsearchClient -->
|
||||||
<elasticsearch-java>8.11.4</elasticsearch-java>
|
<elasticsearch-java>8.11.4</elasticsearch-java>
|
||||||
|
|
||||||
<blockhound-junit>1.0.8.RELEASE</blockhound-junit>
|
|
||||||
<hoverfly>0.14.4</hoverfly>
|
<hoverfly>0.14.4</hoverfly>
|
||||||
<log4j>2.18.0</log4j>
|
<log4j>2.18.0</log4j>
|
||||||
<jsonassert>1.5.1</jsonassert>
|
<jsonassert>1.5.1</jsonassert>
|
||||||
@ -248,13 +247,6 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>io.projectreactor.tools</groupId>
|
|
||||||
<artifactId>blockhound-junit-platform</artifactId>
|
|
||||||
<version>${blockhound-junit}</version>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.skyscreamer</groupId>
|
<groupId>org.skyscreamer</groupId>
|
||||||
<artifactId>jsonassert</artifactId>
|
<artifactId>jsonassert</artifactId>
|
||||||
@ -436,25 +428,6 @@
|
|||||||
</build>
|
</build>
|
||||||
</profile>
|
</profile>
|
||||||
|
|
||||||
<profile>
|
|
||||||
<id>jdk13+</id>
|
|
||||||
<!-- on jDK13+, Blockhound needs this JVM flag set -->
|
|
||||||
<activation>
|
|
||||||
<jdk>[13,)</jdk>
|
|
||||||
</activation>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<argLine>-XX:+AllowRedefinitionToAddDeleteMethods</argLine>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</profile>
|
|
||||||
|
|
||||||
<profile>
|
<profile>
|
||||||
<id>antora-process-resources</id>
|
<id>antora-process-resources</id>
|
||||||
<build>
|
<build>
|
||||||
|
@ -1,43 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2021-2024 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.springframework.data.elasticsearch.blockhound;
|
|
||||||
|
|
||||||
import reactor.blockhound.BlockHound;
|
|
||||||
import reactor.blockhound.BlockingOperationError;
|
|
||||||
import reactor.blockhound.integration.BlockHoundIntegration;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Peter-Josef Meisch
|
|
||||||
*/
|
|
||||||
public class BlockHoundIntegrationCustomizer implements BlockHoundIntegration {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void applyTo(BlockHound.Builder builder) {
|
|
||||||
// Elasticsearch classes reading from the classpath on initialization, needed for parsing Elasticsearch responses
|
|
||||||
builder //
|
|
||||||
.allowBlockingCallsInside("org.elasticsearch.Build", "<clinit>") //
|
|
||||||
.allowBlockingCallsInside("org.elasticsearch.common.xcontent.XContentBuilder", "<clinit>") // pre 7.16
|
|
||||||
.allowBlockingCallsInside("org.elasticsearch.common.XContentBuilder", "<clinit>") // from 7.16 on
|
|
||||||
.allowBlockingCallsInside("org.elasticsearch.xcontent.json.JsonXContent", "contentBuilder") // from 7.16 on
|
|
||||||
.allowBlockingCallsInside("jakarta.json.spi.JsonProvider", "provider") //
|
|
||||||
;
|
|
||||||
builder.blockingMethodCallback(it -> {
|
|
||||||
new Error(it.toString()).printStackTrace();
|
|
||||||
throw new BlockingOperationError(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2021-2024 the original author or authors.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package org.springframework.data.elasticsearch.blockhound;
|
|
||||||
|
|
||||||
import static org.assertj.core.api.Assertions.*;
|
|
||||||
|
|
||||||
import reactor.blockhound.BlockingOperationError;
|
|
||||||
import reactor.core.publisher.Mono;
|
|
||||||
|
|
||||||
import java.time.Duration;
|
|
||||||
|
|
||||||
import org.junit.jupiter.api.DisplayName;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author Peter-Josef Meisch
|
|
||||||
*/
|
|
||||||
public class BlockHoundTests {
|
|
||||||
|
|
||||||
@Test // #1822
|
|
||||||
@DisplayName("should fail if BlockHound is not installed")
|
|
||||||
void shouldFailIfBlockHoundIsNotInstalled() {
|
|
||||||
|
|
||||||
assertThatThrownBy(() -> {
|
|
||||||
Mono.delay(Duration.ofMillis(1)).doOnNext(it -> {
|
|
||||||
try {
|
|
||||||
Thread.sleep(10);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}).block(); // should throw an exception about Thread.sleep
|
|
||||||
}).hasCauseInstanceOf(BlockingOperationError.class);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1 +0,0 @@
|
|||||||
org.springframework.data.elasticsearch.blockhound.BlockHoundIntegrationCustomizer
|
|
Loading…
x
Reference in New Issue
Block a user