-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use a timer when awaiting Quartz shutdown
The Quartz scheduler shutdown seems like it can block indefinitely if there is an exception in a yet to be completed job. To guard against this, we ensure that we only wait a configurable amount of time for the scheduler to shut down. This is a breaking change because previously we waited indefinitely. Relates to #28114
- Loading branch information
Showing
3 changed files
with
80 additions
and
3 deletions.
There are no files selected for viewing
49 changes: 49 additions & 0 deletions
49
core/deployment/src/main/java/io/quarkus/deployment/util/IsKotlinDataClassPredicate.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package io.quarkus.deployment.util; | ||
|
||
import java.lang.reflect.Modifier; | ||
import java.util.List; | ||
import java.util.function.Predicate; | ||
import org.jboss.jandex.ClassInfo; | ||
import org.jboss.jandex.MethodInfo; | ||
|
||
/** | ||
* Tests whether a class is a data class (based on this answer: | ||
* https://discuss.kotlinlang.org/t/detect-data-class-in-runtime/6155/2) | ||
* and whether the class has default values for fields (default values leads to having multiple constructors in bytecode) | ||
*/ | ||
public class IsKotlinDataClassPredicate implements Predicate<ClassInfo> { | ||
|
||
private final boolean testForDefaultValues; | ||
|
||
public IsKotlinDataClassPredicate(boolean testForDefaultValues) { | ||
this.testForDefaultValues = testForDefaultValues; | ||
} | ||
|
||
@Override | ||
public boolean test(ClassInfo classInfo) { | ||
int ctorCount = 0; | ||
boolean hasCopyMethod = false; | ||
boolean hasStaticCopyMethod = false; | ||
boolean hasComponent1Method = false; | ||
List<MethodInfo> methods = classInfo.methods(); | ||
for (MethodInfo method : methods) { | ||
String methodName = method.name(); | ||
if ("<init>".equals(methodName)) { | ||
ctorCount++; | ||
} else if ("component1".equals(methodName) && Modifier.isFinal(method.flags())) { | ||
hasComponent1Method = true; | ||
} else if ("copy".equals(methodName) && Modifier.isFinal(method.flags())) { | ||
hasCopyMethod = true; | ||
} else if ("copy$default".equals(methodName) && Modifier.isStatic(method.flags())) { | ||
hasStaticCopyMethod = true; | ||
} | ||
} | ||
|
||
boolean isDataClass = hasComponent1Method && hasCopyMethod && hasStaticCopyMethod; | ||
if (testForDefaultValues) { | ||
return ctorCount > 1 && isDataClass; | ||
} else { | ||
return isDataClass; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters