Jochen Theodorou | 5 Aug 17:51
Gravatar

[groovy-dev] Closure, Registry and MetaClass serialization

Hi all,

before I go and commmit my serialization code there are a few things we 
should maybe discuss.

I made several tries for the serialization code which is the reason why 
it took me so long. Any way, in the last version I decided to not to do 
a full serialization of all things, but go with a mixed 
serialization/recreation technique. What I try to avoid is making our 
custom data structures part of the serialization process. The reason 
behind this is, that they seem not to be stable enough and are part of 
many changes. The problem with serialization now is, that if a field has 
for example has one of our has maps with two keys and is final, then I 
can not serialize the class unless I serialize that data structure or 
remove the final. I decided for removing final, but the result is then 
of course a change in runtime performance.

One of my biggest problems was serializing MetaMethod, because it is 
coupled very tightly to many internal data structures.

So what I serialize is Closure and variant of Closure, including 
subclasses generated by the compiler. I can serialize the registry along 
with MetaClassImpl and ExpandoMetaClass, but serializing modifications 
to EMC will be possible only if the method/property was added using the 
builder Alex made, or the old foo.metaClass.bar = ... style.

I somehow broke mixins somewhere, I still have to fix that, but I guess 
serializing them is possible too.

What won't be serializable is when custom MetaMethods are added. Also 
(Continue reading)

Alex Tkachman | 5 Aug 19:52

Re: [groovy-dev] Closure, Registry and MetaClass serialization

On Tue, Aug 5, 2008 at 7:55 PM, Jochen Theodorou <blackdrag@...> wrote:
> Hi all,
>
> before I go and commmit my serialization code there are a few things we
> should maybe discuss.
>
> I made several tries for the serialization code which is the reason why it
> took me so long. Any way, in the last version I decided to not to do a full
> serialization of all things, but go with a mixed serialization/recreation
> technique. What I try to avoid is making our custom data structures part of
> the serialization process. The reason behind this is, that they seem not to
> be stable enough and are part of many changes.

I think it is very right design decision.

> The problem with
> serialization now is, that if a field has for example has one of our has
> maps with two keys and is final, then I can not serialize the class unless I
> serialize that data structure or remove the final. I decided for removing
> final, but the result is then of course a change in runtime performance.
>

Could you please explain a little bit deeper?

> One of my biggest problems was serializing MetaMethod, because it is coupled
> very tightly to many internal data structures.
>
> So what I serialize is Closure and variant of Closure, including subclasses
> generated by the compiler. I can serialize the registry along with
> MetaClassImpl and ExpandoMetaClass, but serializing modifications to EMC
(Continue reading)

Jochen Theodorou | 5 Aug 20:03
Gravatar

Re: [groovy-dev] Closure, Registry and MetaClass serialization

Alex Tkachman schrieb:
> On Tue, Aug 5, 2008 at 7:55 PM, Jochen Theodorou <blackdrag@...> wrote:
>> Hi all,
>>
>> before I go and commmit my serialization code there are a few things we
>> should maybe discuss.
>>
>> I made several tries for the serialization code which is the reason why it
>> took me so long. Any way, in the last version I decided to not to do a full
>> serialization of all things, but go with a mixed serialization/recreation
>> technique. What I try to avoid is making our custom data structures part of
>> the serialization process. The reason behind this is, that they seem not to
>> be stable enough and are part of many changes.
> 
> I think it is very right design decision.

good.

>> The problem with
>> serialization now is, that if a field has for example has one of our has
>> maps with two keys and is final, then I can not serialize the class unless I
>> serialize that data structure or remove the final. I decided for removing
>> final, but the result is then of course a change in runtime performance.
> 
> Could you please explain a little bit deeper?

well I think you made several fields in MetaClassImpl and EMC final 
because of speed reasons, or not? For example in MetaClassImpl we can 
find these final fields:

(Continue reading)


Gmane