You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@directmemory.apache.org by Martin Spasovski <sh...@gmail.com> on 2012/11/05 23:13:57 UTC

deserialization question

Hi everyone! My first message here...

I've started working with DirectMemory few days ago (with 0.1-incubating).
According to me, a cool project, and can't wait for 0.2! :)

Now, my problem. I'm implementing a List so that uses DirectMemory inside
of it, which I plan to release it on github/bitbucket as soon as it's
pretty stable. Little more about it, every list implementation has it's
UUID field and the keys are strings in the form of UUID:index. That way
keys won't be mixed in the cache manager.

The problem is, that when testing the List implementation, I put simple
stuff like String, Integer, etc...
But when I use it with someting more 'serious', when I put one my own
classes, I get this message when I try to retrieve it:

ERROR2012-11-05 17:04:31,252
[org.apache.directmemory.cache.CacheServiceImpl.retrieve:209] -
[Ljava.lang.Object;

And it returns a null.
Note, when I put it in the cache I don't get any errors at all.

I really don't have a clue what the problem is, any help is more than
welcomed.

-- 
Martin
http://thisismartin.com/
http://www.linkedin.com/in/spasovskimartin
http://twitter.com/moondowner

Re: deserialization question

Posted by Martin Spasovski <sh...@gmail.com>.
Hi guys,

@Olivier thanks for the url.

So, found time to make a standalone project with this List implementation,
and here's the code:

https://github.com/moondowner/directcollections/blob/master/directcollections/src/main/java/com/thisismartin/directcollections/DirectMemoryList.java

I have some stuff to fix, but more or less that's it. I'll also make a
Queue implementation in future.

I also have some comments about the serializers.

For example, the KryoSerializer can only be instanced and set as serializer
to a cache service. But, if I want to change some of its properties, for
example to make kryo.setReferences(true), or to register my custom
serializer for some type, I had to make my own Kryo serializer, and by
doing this directmemory-kryo was not needed at all.

Maybe some of these methods should be exposed so that this was not needed.

I'd be happy to hear some comments/recommendations on the List
implementation.

Cheers,


On Tue, Nov 6, 2012 at 10:00 AM, Olivier Lamy <ol...@apache.org> wrote:

> Snapshot repo is here:
> https://repository.apache.org/content/repositories/snapshots
>
> 2012/11/6 Martin Spasovski <sh...@gmail.com>:
> > @Raffaele, will do. Is there any Maven repo with a 0.2-snapshot (or
> anything
> > similar)? If there isn't I'll just build it myself..
> >
> > @Christoph Yes, I'm implementing the List interface :)
> >
> > By the way, about my serialization problem with my custom classes, I
> think I
> > have a cyclic dependency somewhere and that's the problem maybe... When I
> > use the directmemory-protostuff module I get the following:
> >
> > java.lang.StackOverflowError
> >     at
> >
> com.dyuproject.protostuff.StringSerializer.writeUTF8VarDelimited(StringSerializer.java:917)
> >     at
> >
> com.dyuproject.protostuff.WriteSink$1.writeStrUTF8VarDelimited(WriteSink.java:264)
> >     at
> >
> com.dyuproject.protostuff.ProtostuffOutput.writeString(ProtostuffOutput.java:311)
> >     at
> >
> com.dyuproject.protostuff.runtime.DefaultIdStrategy.writePojoIdTo(DefaultIdStrategy.java:324)
> >     at
> >
> com.dyuproject.protostuff.runtime.DerivativeSchema.writeTo(DerivativeSchema.java:103)
> >     at
> >
> com.dyuproject.protostuff.ProtostuffOutput.writeObject(ProtostuffOutput.java:373)
> >     at
> >
> com.dyuproject.protostuff.runtime.RuntimeUnsafeFieldFactory$14$1.writeTo(RuntimeUnsafeFieldFactory.java:835)
> >     at
> >
> com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:195)
> >     at
> >
> com.dyuproject.protostuff.ProtostuffOutput.writeObject(ProtostuffOutput.java:373)
> >     at
> >
> com.dyuproject.protostuff.runtime.RuntimeRepeatedFieldFactory$3.writeTo(RuntimeRepeatedFieldFactory.java:244)
> >     at
> >
> com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:195)
> >     at
> >
> com.dyuproject.protostuff.runtime.DerivativeSchema.writeTo(DerivativeSchema.java:113)
> >     at
> >
> com.dyuproject.protostuff.ProtostuffOutput.writeObject(ProtostuffOutput.java:373)
> >     at
> >
> com.dyuproject.protostuff.runtime.RuntimeUnsafeFieldFactory$14$1.writeTo(RuntimeUnsafeFieldFactory.java:835)
> >     at
> >
> com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:195)
> >     at
> >
> com.dyuproject.protostuff.ProtostuffOutput.writeObject(ProtostuffOutput.java:373)
> >     at
> >
> com.dyuproject.protostuff.runtime.RuntimeRepeatedFieldFactory$3.writeTo(RuntimeRepeatedFieldFactory.java:244)
> >     at
> >
> com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:195)
> > ...
> >
> > And this is when putting in cache.
> >
> >
> > On Tue, Nov 6, 2012 at 8:29 AM, Christoph Engelbert <
> noctarius@apache.org>
> > wrote:
> >>
> >> I'm really looking forward to see the List implementation. Hopefully
> >> you'll implement it using the List interface :-)
> >>
> >> Cheers Chris
> >>
> >>
> >>
> >> Martin Spasovski <sh...@gmail.com> schrieb:
> >>>
> >>> Hi everyone! My first message here...
> >>>
> >>> I've started working with DirectMemory few days ago (with
> >>> 0.1-incubating). According to me, a cool project, and can't wait for
> 0.2! :)
> >>>
> >>> Now, my problem. I'm implementing a List so that uses DirectMemory
> inside
> >>> of it, which I plan to release it on github/bitbucket as soon as it's
> pretty
> >>> stable. Little more about it, every list implementation has it's UUID
> field
> >>> and the keys are strings in the form of UUID:index. That way keys
> won't be
> >>> mixed in the cache manager.
> >>>
> >>> The problem is, that when testing the List implementation, I put simple
> >>> stuff like String, Integer, etc...
> >>> But when I use it with someting more 'serious', when I put one my own
> >>> classes, I get this message when I try to retrieve it:
> >>>
> >>> ERROR2012-11-05 17:04:31,252
> >>> [org.apache.directmemory.cache.CacheServiceImpl.retrieve:209] -
> >>> [Ljava.lang.Object;
> >>>
> >>> And it returns a null.
> >>> Note, when I put it in the cache I don't get any errors at all.
> >>>
> >>> I really don't have a clue what the problem is, any help is more than
> >>> welcomed.
> >>
> >>
> >> --
> >> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
> >> gesendet.
> >
> >
> >
> >
> > --
> > Martin
> > http://thisismartin.com/
> > http://www.linkedin.com/in/spasovskimartin
> > http://twitter.com/moondowner
>
>
>
> --
> Olivier Lamy
> Talend: http://coders.talend.com
> http://twitter.com/olamy | http://linkedin.com/in/olamy
>



-- 
Martin
http://thisismartin.com/
http://www.linkedin.com/in/spasovskimartin
http://twitter.com/moondowner

Re: deserialization question

Posted by Olivier Lamy <ol...@apache.org>.
Snapshot repo is here:
https://repository.apache.org/content/repositories/snapshots

2012/11/6 Martin Spasovski <sh...@gmail.com>:
> @Raffaele, will do. Is there any Maven repo with a 0.2-snapshot (or anything
> similar)? If there isn't I'll just build it myself..
>
> @Christoph Yes, I'm implementing the List interface :)
>
> By the way, about my serialization problem with my custom classes, I think I
> have a cyclic dependency somewhere and that's the problem maybe... When I
> use the directmemory-protostuff module I get the following:
>
> java.lang.StackOverflowError
>     at
> com.dyuproject.protostuff.StringSerializer.writeUTF8VarDelimited(StringSerializer.java:917)
>     at
> com.dyuproject.protostuff.WriteSink$1.writeStrUTF8VarDelimited(WriteSink.java:264)
>     at
> com.dyuproject.protostuff.ProtostuffOutput.writeString(ProtostuffOutput.java:311)
>     at
> com.dyuproject.protostuff.runtime.DefaultIdStrategy.writePojoIdTo(DefaultIdStrategy.java:324)
>     at
> com.dyuproject.protostuff.runtime.DerivativeSchema.writeTo(DerivativeSchema.java:103)
>     at
> com.dyuproject.protostuff.ProtostuffOutput.writeObject(ProtostuffOutput.java:373)
>     at
> com.dyuproject.protostuff.runtime.RuntimeUnsafeFieldFactory$14$1.writeTo(RuntimeUnsafeFieldFactory.java:835)
>     at
> com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:195)
>     at
> com.dyuproject.protostuff.ProtostuffOutput.writeObject(ProtostuffOutput.java:373)
>     at
> com.dyuproject.protostuff.runtime.RuntimeRepeatedFieldFactory$3.writeTo(RuntimeRepeatedFieldFactory.java:244)
>     at
> com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:195)
>     at
> com.dyuproject.protostuff.runtime.DerivativeSchema.writeTo(DerivativeSchema.java:113)
>     at
> com.dyuproject.protostuff.ProtostuffOutput.writeObject(ProtostuffOutput.java:373)
>     at
> com.dyuproject.protostuff.runtime.RuntimeUnsafeFieldFactory$14$1.writeTo(RuntimeUnsafeFieldFactory.java:835)
>     at
> com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:195)
>     at
> com.dyuproject.protostuff.ProtostuffOutput.writeObject(ProtostuffOutput.java:373)
>     at
> com.dyuproject.protostuff.runtime.RuntimeRepeatedFieldFactory$3.writeTo(RuntimeRepeatedFieldFactory.java:244)
>     at
> com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:195)
> ...
>
> And this is when putting in cache.
>
>
> On Tue, Nov 6, 2012 at 8:29 AM, Christoph Engelbert <no...@apache.org>
> wrote:
>>
>> I'm really looking forward to see the List implementation. Hopefully
>> you'll implement it using the List interface :-)
>>
>> Cheers Chris
>>
>>
>>
>> Martin Spasovski <sh...@gmail.com> schrieb:
>>>
>>> Hi everyone! My first message here...
>>>
>>> I've started working with DirectMemory few days ago (with
>>> 0.1-incubating). According to me, a cool project, and can't wait for 0.2! :)
>>>
>>> Now, my problem. I'm implementing a List so that uses DirectMemory inside
>>> of it, which I plan to release it on github/bitbucket as soon as it's pretty
>>> stable. Little more about it, every list implementation has it's UUID field
>>> and the keys are strings in the form of UUID:index. That way keys won't be
>>> mixed in the cache manager.
>>>
>>> The problem is, that when testing the List implementation, I put simple
>>> stuff like String, Integer, etc...
>>> But when I use it with someting more 'serious', when I put one my own
>>> classes, I get this message when I try to retrieve it:
>>>
>>> ERROR2012-11-05 17:04:31,252
>>> [org.apache.directmemory.cache.CacheServiceImpl.retrieve:209] -
>>> [Ljava.lang.Object;
>>>
>>> And it returns a null.
>>> Note, when I put it in the cache I don't get any errors at all.
>>>
>>> I really don't have a clue what the problem is, any help is more than
>>> welcomed.
>>
>>
>> --
>> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
>> gesendet.
>
>
>
>
> --
> Martin
> http://thisismartin.com/
> http://www.linkedin.com/in/spasovskimartin
> http://twitter.com/moondowner



-- 
Olivier Lamy
Talend: http://coders.talend.com
http://twitter.com/olamy | http://linkedin.com/in/olamy

Re: deserialization question

Posted by Martin Spasovski <sh...@gmail.com>.
@Raffaele, will do. Is there any Maven repo with a 0.2-snapshot (or
anything similar)? If there isn't I'll just build it myself..

@Christoph Yes, I'm implementing the List interface :)

By the way, about my serialization problem with my custom classes, I think
I have a cyclic dependency somewhere and that's the problem maybe... When I
use the directmemory-protostuff module I get the following:

java.lang.StackOverflowError
    at
com.dyuproject.protostuff.StringSerializer.writeUTF8VarDelimited(StringSerializer.java:917)
    at
com.dyuproject.protostuff.WriteSink$1.writeStrUTF8VarDelimited(WriteSink.java:264)
    at
com.dyuproject.protostuff.ProtostuffOutput.writeString(ProtostuffOutput.java:311)
    at
com.dyuproject.protostuff.runtime.DefaultIdStrategy.writePojoIdTo(DefaultIdStrategy.java:324)
    at
com.dyuproject.protostuff.runtime.DerivativeSchema.writeTo(DerivativeSchema.java:103)
    at
com.dyuproject.protostuff.ProtostuffOutput.writeObject(ProtostuffOutput.java:373)
    at
com.dyuproject.protostuff.runtime.RuntimeUnsafeFieldFactory$14$1.writeTo(RuntimeUnsafeFieldFactory.java:835)
    at
com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:195)
    at
com.dyuproject.protostuff.ProtostuffOutput.writeObject(ProtostuffOutput.java:373)
    at
com.dyuproject.protostuff.runtime.RuntimeRepeatedFieldFactory$3.writeTo(RuntimeRepeatedFieldFactory.java:244)
    at
com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:195)
    at
com.dyuproject.protostuff.runtime.DerivativeSchema.writeTo(DerivativeSchema.java:113)
    at
com.dyuproject.protostuff.ProtostuffOutput.writeObject(ProtostuffOutput.java:373)
    at
com.dyuproject.protostuff.runtime.RuntimeUnsafeFieldFactory$14$1.writeTo(RuntimeUnsafeFieldFactory.java:835)
    at
com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:195)
    at
com.dyuproject.protostuff.ProtostuffOutput.writeObject(ProtostuffOutput.java:373)
    at
com.dyuproject.protostuff.runtime.RuntimeRepeatedFieldFactory$3.writeTo(RuntimeRepeatedFieldFactory.java:244)
    at
com.dyuproject.protostuff.runtime.MappedSchema.writeTo(MappedSchema.java:195)
...

And this is when putting in cache.


On Tue, Nov 6, 2012 at 8:29 AM, Christoph Engelbert <no...@apache.org>wrote:

> I'm really looking forward to see the List implementation. Hopefully
> you'll implement it using the List interface :-)
>
> Cheers Chris
>
>
>
> Martin Spasovski <sh...@gmail.com> schrieb:
>
>> Hi everyone! My first message here...
>>
>> I've started working with DirectMemory few days ago (with
>> 0.1-incubating). According to me, a cool project, and can't wait for 0.2! :)
>>
>> Now, my problem. I'm implementing a List so that uses DirectMemory inside
>> of it, which I plan to release it on github/bitbucket as soon as it's
>> pretty stable. Little more about it, every list implementation has it's
>> UUID field and the keys are strings in the form of UUID:index. That way
>> keys won't be mixed in the cache manager.
>>
>> The problem is, that when testing the List implementation, I put simple
>> stuff like String, Integer, etc...
>> But when I use it with someting more 'serious', when I put one my own
>> classes, I get this message when I try to retrieve it:
>>
>> ERROR2012-11-05 17:04:31,252
>> [org.apache.directmemory.cache.CacheServiceImpl.retrieve:209] -
>> [Ljava.lang.Object;
>>
>> And it returns a null.
>> Note, when I put it in the cache I don't get any errors at all.
>>
>> I really don't have a clue what the problem is, any help is more than
>> welcomed.
>>
>
> --
> Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail
> gesendet.
>



-- 
Martin
http://thisismartin.com/
http://www.linkedin.com/in/spasovskimartin
http://twitter.com/moondowner

Re: deserialization question

Posted by Christoph Engelbert <no...@apache.org>.
I'm really looking forward to see the List implementation. Hopefully you'll implement it using the List interface :-) 

Cheers Chris



Martin Spasovski <sh...@gmail.com> schrieb:

>Hi everyone! My first message here...
>
>I've started working with DirectMemory few days ago (with
>0.1-incubating).
>According to me, a cool project, and can't wait for 0.2! :)
>
>Now, my problem. I'm implementing a List so that uses DirectMemory
>inside
>of it, which I plan to release it on github/bitbucket as soon as it's
>pretty stable. Little more about it, every list implementation has it's
>UUID field and the keys are strings in the form of UUID:index. That way
>keys won't be mixed in the cache manager.
>
>The problem is, that when testing the List implementation, I put simple
>stuff like String, Integer, etc...
>But when I use it with someting more 'serious', when I put one my own
>classes, I get this message when I try to retrieve it:
>
>ERROR2012-11-05 17:04:31,252
>[org.apache.directmemory.cache.CacheServiceImpl.retrieve:209] -
>[Ljava.lang.Object;
>
>And it returns a null.
>Note, when I put it in the cache I don't get any errors at all.
>
>I really don't have a clue what the problem is, any help is more than
>welcomed.
>
>-- 
>Martin
>http://thisismartin.com/
>http://www.linkedin.com/in/spasovskimartin
>http://twitter.com/moondowner

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

Re: deserialization question

Posted by "Raffaele P. Guidi" <ra...@gmail.com>.
Uhm I strongly suggest to upgrade to the more recent snapshot - 0.1 is not
much of a stable release in any case :-P

Ciao,
    R
Il giorno 05/nov/2012 23:14, "Martin Spasovski" <sh...@gmail.com> ha
scritto:

> Hi everyone! My first message here...
>
> I've started working with DirectMemory few days ago (with 0.1-incubating).
> According to me, a cool project, and can't wait for 0.2! :)
>
> Now, my problem. I'm implementing a List so that uses DirectMemory inside
> of it, which I plan to release it on github/bitbucket as soon as it's
> pretty stable. Little more about it, every list implementation has it's
> UUID field and the keys are strings in the form of UUID:index. That way
> keys won't be mixed in the cache manager.
>
> The problem is, that when testing the List implementation, I put simple
> stuff like String, Integer, etc...
> But when I use it with someting more 'serious', when I put one my own
> classes, I get this message when I try to retrieve it:
>
> ERROR2012-11-05 17:04:31,252
> [org.apache.directmemory.cache.CacheServiceImpl.retrieve:209] -
> [Ljava.lang.Object;
>
> And it returns a null.
> Note, when I put it in the cache I don't get any errors at all.
>
> I really don't have a clue what the problem is, any help is more than
> welcomed.
>
> --
> Martin
> http://thisismartin.com/
> http://www.linkedin.com/in/spasovskimartin
> http://twitter.com/moondowner
>