jeanouii commented on code in PR #1563:
URL: https://github.com/apache/activemq/pull/1563#discussion_r2769315087
##########
activemq-client/src/main/java/org/apache/activemq/thread/TaskRunnerFactory.java:
##########
@@ -273,13 +267,20 @@ protected TaskRunner
createVirtualThreadTaskRunner(Executor executor, Task task,
if(!TaskRunner.class.isAssignableFrom(result.getClass())) {
throw new IllegalStateException("VirtualThreadTaskRunner not
returned");
}
- return TaskRunner.class.cast(result);
+ return (TaskRunner) result;
} catch (ClassNotFoundException | NoSuchMethodException |
SecurityException | IllegalAccessException | InvocationTargetException |
InstantiationException | IllegalArgumentException e) {
LOG.error("VirtualThreadTaskRunner class failed to load", e);
throw new IllegalStateException(e);
}
}
+ private void assertJDK21VirtualThreadSupport() {
+ if(!(Runtime.version().feature() >= 21)) {
+ LOG.error("Virtual Thread support requires JDK 21 or higher");
+ throw new IllegalStateException("Virtual Thread support requires
JDK 21 or higher");
+ }
+ }
+
Review Comment:
This was a refactoring of @mattrpav 's code. So I'd let him reply.
I agree that having the assertion to fail would be weird because that would
mean the JVM could not read the MRJAR but still run in some way this class.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact