commit
999d99e655
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2023 the original author or authors.
|
||||
* Copyright 2012-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.
|
||||
|
@ -29,6 +29,7 @@ import org.springframework.core.Ordered;
|
|||
import org.springframework.core.annotation.Order;
|
||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
|
@ -142,8 +143,17 @@ class OnClassCondition extends FilteringSpringBootCondition {
|
|||
|
||||
private volatile ConditionOutcome[] outcomes;
|
||||
|
||||
private volatile Throwable failure;
|
||||
|
||||
private ThreadedOutcomesResolver(OutcomesResolver outcomesResolver) {
|
||||
this.thread = new Thread(() -> this.outcomes = outcomesResolver.resolveOutcomes());
|
||||
this.thread = new Thread(() -> {
|
||||
try {
|
||||
this.outcomes = outcomesResolver.resolveOutcomes();
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
this.failure = ex;
|
||||
}
|
||||
});
|
||||
this.thread.start();
|
||||
}
|
||||
|
||||
|
@ -155,6 +165,9 @@ class OnClassCondition extends FilteringSpringBootCondition {
|
|||
catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
if (this.failure != null) {
|
||||
ReflectionUtils.rethrowRuntimeException(this.failure);
|
||||
}
|
||||
return this.outcomes;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue