msolli / proletarian

A durable job queuing and worker system for Clojure backed by PostgreSQL or MySQL.
MIT License
178 stars 9 forks source link

Reflection warning in `proletarian/worker.clj` on JDK 20 #17

Closed p-himik closed 9 months ago

p-himik commented 1 year ago

Just noticed this warning:

Reflection warning, proletarian/worker.clj:235:16 - call to static method sleep on java.lang.Thread can't be resolved (argument types: java.lang.Number).

The reason is probably because Thread in JDK 20 now has two sleep methods with a single argument.

raszi commented 9 months ago

We've got even more reflection warnings with 1.0.41-alpha:

Reflection warning, proletarian/executor.clj:26:5 - call to method scheduleWithFixedDelay can't be resolved (target class is unknown).
Reflection warning, proletarian/executor.clj:29:17 - reference to field isShutdown can't be resolved.
Reflection warning, proletarian/executor.clj:34:7 - reference to field isShutdown can't be resolved.
Reflection warning, proletarian/executor.clj:39:7 - reference to field shutdown can't be resolved.
Reflection warning, proletarian/executor.clj:41:7 - reference to field shutdownNow can't be resolved.
Reflection warning, proletarian/executor.clj:43:15 - call to method awaitTermination can't be resolved (target class is unknown).
Reflection warning, proletarian/executor.clj:49:9 - reference to field shutdownNow can't be resolved.
Reflection warning, proletarian/worker.clj:199:16 - call to static method sleep on java.lang.Thread can't be resolved (argument types: java.lang.Number).
msolli commented 9 months ago

Thanks for reporting! Both these have now been fixed: https://github.com/msolli/proletarian/commit/b991f66d85c4ba63c278d8da630c344752ca787d https://github.com/msolli/proletarian/commit/2ee188f3ffb1d96cbd5776ae184dce79d5d73b26

To use the latest Proletarian with these fixes:

msolli/proletarian {:git/url "https://github.com/msolli/proletarian"
                    :sha     "2ee188f3ffb1d96cbd5776ae184dce79d5d73b26"}
raszi commented 8 months ago

Thank you for the fix! Are you planning to release a new version?