absurdfarce commented on PR #2059:
URL: 
https://github.com/apache/cassandra-java-driver/pull/2059#issuecomment-4007528533

   So... I'm a little skeptical about this as a default approach for the Java 
driver.
   
   I can reproduce this problem using GraalVM 25 on the Spring AOT smoke test 
repo specified by @lukasz-antoniak above.  If it were a widespread problem I 
should see it elsewhere, though, and I absolutely _cannot_ reproduce this with 
the cassandra-quarkus native tests... which seems strange.  Seems like 
understanding the nature of that difference in behaviour is pretty important 
here.
   
   Stepping back a bit, why would Graal be attempting to initialize this class 
at build time at all?  The target class for the substitution is 
com.google.common.primitives.UnsignedBytes.LexicographicalComparatorHolder 
which is only referenced in 
[ByteOrderedToken](https://github.com/apache/cassandra-java-driver/blob/4.19.2/core/src/main/java/com/datastax/oss/driver/internal/core/metadata/token/ByteOrderedToken.java#L60-L66)
 as far as I can tell.  Instances of that class are provided by a factory impl 
that's determined by [a 
registry](https://github.com/apache/cassandra-java-driver/blob/4.19.2/core/src/main/java/com/datastax/oss/driver/internal/core/metadata/token/DefaultTokenFactoryRegistry.java#L36-L52).
  In normal driver operation that registry determines which token factory to 
return based on the contents of system.local... so you'd only actually need 
this class at runtime if you were using that partitioner.  There's no way to 
determine that at build time, however, so it makes sen
 se that this class would be initialized at runtime as you would normally 
expect.
   
   In short: I don't understand why the Spring smoke tests are triggering 
something in GraalVM that's trying to do a build-time class initialization.  
This seems like it might be situation-dependent behaviour, and if that's the 
case a fix in the Spring AOT smoke test repo is absolutely the correct way to 
handle this situation.
   
   So I guess I'm not convinced we should add this as a general config for 
_all_ GraalVM clients using the Java driver.


-- 
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]

Reply via email to