Good idea!
Let's see how this could be improved.

I didn't say it explicitly in my previous mail but my commit was in a
separate branch. It is not yet planned for the next release. It should
be approved first from you.

On Wed, Oct 10, 2012 at 4:11 PM, Emond Papegaaij
<[email protected]> wrote:
> I did not yet replace our checker with the new one. One of the changes we made
> to the checker was that we removed a few lines to improve performance. The old
> SerializableChecker uses string concatenation all over the place, and a few of
> those places introduce a serious performance overhead (I'm talking about
> minutes, not milliseconds). The most important ones are 'String arrayPos = "["
> + i + "]";' and 'String arrayPos = "[" + i + "]";'. A large set (with
> thousands or records) generates 10th's of thousands string concatenations,
> which takes a long time. It would be nice if we could fix that as well.
>
> Best regards,
> Emond
>
> On Wednesday 10 October 2012 16:00:23 Martin Grigorov wrote:
>> Hi,
>>
>> With
>> https://git-wip-us.apache.org/repos/asf/wicket/repo?p=wicket.git;a=commitdi
>> ff;h=6014d8bb92595bf486d69f7a5c1c798bcdc252f1 I extracted the logic for
>> reading object members with
>> ObjectStreamClass into a separate class ObjectChecker. This new class
>> uses implementations of IObjectChecker to do the actual checks. For
>> now there are two impls:
>> - check that the class is Serializable (as before)
>> - check that instances of LoadableDetachableModel are detached before
>> serialization. This own proved to be quite useful !
>>
>> It is quite easy to add your own custom checkers. For example like the
>> ones explained at
>> http://wicketinaction.com/2011/11/detect-attached-models-and-entities/
>> for JPA entities.
>>
>> I tried to keep SerializableChecker binary compatible so it has some
>> baggage which may be removed for Wicket 7.0.
>> If any of the checkers fail then the pretty print message is used to
>> show where is the problem and its type.
>>
>> The usage is:
>> JavaSerializer serializer = new JavaSerializer(app.getKey()) {
>>    @Override
>>    protected ObjectOutputStream newObjectOutputStream(OutputStream
>> out) throws IOException {
>>        return new ObjectCheckerObjectOutputStream(out, new
>> ObjectSerializationChecker(), new NotDetachedModelChecker(), new
>> MyOwnChecker());
>>    }
>> }
>> app.getFrameworkSettings().setSerializer(serializer);
>>
>> Please have a look and give your opinion. Any suggestions are welcome!



-- 
Martin Grigorov
jWeekend
Training, Consulting, Development
http://jWeekend.com

Reply via email to