-
1. Re: Need to use non serializable keys
manik Feb 17, 2010 4:59 AM (in response to sannegrinovero)1 of 1 people found this helpfulsannegrinovero wrote:
org.infinispan.marshall.TestObjectStreamMarshaller is having an interesting comment:
A dummy marshaller impl that uses JBoss Marshalling object streams as they do not require that the objects being
serialized/deserialized implement Serializable.Does it mean I could use that?
Sorry to be the bearer of bad news, the comment on the TestObjectStreamMarshaller is incorrect. That should read "A dummy .... object streams as they do require that ... "
The TestObjectStreamMarshaller uses XStream to encode objects. It's slow, but it does work. Perhaps you could use a similar strategy? E.g.,
your key -> XStream -> a String which you can use with Infinispan
I'll let Galder comment on the feasibility of exposing JBoss Marshalling externalizers as public API.
-
2. Re: Need to use non serializable keys
galder.zamarreno Feb 17, 2010 6:01 AM (in response to manik)I've added an FAQ entry to http://community.jboss.org/docs/DOC-13439 where we explain what we currently support wrt Non-Serializable objects. Sanne, as you can see, we don't expect to expose the possibility of clients providing their own Externalizer implementations until Infinispan 4.1.1 of 1 people found this helpful -
3. Re: Need to use non serializable keys
sannegrinovero Feb 17, 2010 1:55 PM (in response to sannegrinovero)thanks for the detailed answers; I would need this before any date a 4.1 release could be estimated at
XStream would be fine as a general purpose solution but I'd avoid making it slow, and it wouldn't be easy to replace the keys with 1-1 value objects, too many cases: I can barely intercept the current Map usage and inject an Infinispan Map;
I'll try to extend VersionAwareMarshaller to use a custom org.infinispan.marshall.jboss.JBossMarshaller where I could hardcode my configuration; you know if there is such an option to not verify if it's serializable and automagically use an alternative strategy? All my cases are simple value objects, like a couple of Strings, a String and an int, two longs... it would have been trivial to just mark them Serializable.
-
4. Re: Need to use non serializable keys
galder.zamarreno Mar 2, 2010 6:14 AM (in response to sannegrinovero)
sannegrinovero wrote:...
I'll try to extend VersionAwareMarshaller to use a custom org.infinispan.marshall.jboss.JBossMarshaller where I could hardcode my configuration; you know if there is such an option to not verify if it's serializable and automagically use an alternative strategy? All my cases are simple value objects, like a couple of Strings, a String and an int, two longs... it would have been trivial to just mark them Serializable.
Serializable verification is done by JBoss Marshaller and not Infinispan. Using a custom JBossMarshaller is probably your only option. In that class, you'd need to use a different org.infinispan.marshall.jboss.ConstantObjectTable to the one used by Infinispan so that it contains the Externalizer link between your class and the Externalizer that it uses. This is a big hack though but currently the only way u can get around this.