Friday, April 22, 2011

Exploring Yahoo S4 with Clojure | opus artificem probat

Unfortunately, when using Clojure types, the resulting Java classes will not integrate easily into the S4 model since they don’t implement the standard bean interface and, as a result, could not be easily configured in a Spring configuration file. Furthermore, the standard serialization mechanism used in S4 at the moment, the Kryo serialization library, cannot serialize most of Clojure generated classes and default types, since it is unable to deserialize fields marked as final and because it requires argument-less constructors that clojure core types, like Keyword do not implement. In fact it makes even impossible to generate a serializable bean using the gen-class macro since this macro places the state into a final field.

Clj-s4 solves this issue introducing a new macro def-s4-message similar todeferecord that generates a mutable java bean for the provided field descriptions.

Update on Kyro: the serialization of final fields has been fixed according to the bug report.

Posted via email from miner49r

No comments: