You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Alastair Maw (JIRA)" <ji...@apache.org> on 2007/08/17 17:48:30 UTC

[jira] Commented: (WICKET-857) Method of forcing the use of transient

    [ https://issues.apache.org/jira/browse/WICKET-857?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12520593 ] 

Alastair Maw commented on WICKET-857:
-------------------------------------

Hmmm. I think you have this backwards. You shouldn't be making your fields transient. Instead, you should be making sure you can serialize them. Otherwise when you rely on the fields in your onClick handlers, etc. stuff will break if your page is serialized out to disk/clustered session store/whatever. This is obviously bad!

You definitely, definitely don't want to have to specify @SkipSerializableCheck on all your fields. Besides, that's not really what you're doing. You're checking to see if it's transient. That's not checking to see if it's serializable.

Wicket already handles this by making sure your fields are serializable in dev mode with nice error reporting if they're not.

In short, I'm sorry but I think you have the wrong end of the stick here - making your fields transient is not the correct solution to whatever problem you're seeing.

This should be marked invalid.

> Method of forcing the use of transient
> --------------------------------------
>
>                 Key: WICKET-857
>                 URL: https://issues.apache.org/jira/browse/WICKET-857
>             Project: Wicket
>          Issue Type: New Feature
>          Components: wicket
>    Affects Versions: 1.3.0-beta2
>            Reporter: Roy van Rijn
>             Fix For: 1.4.0-alpha
>
>         Attachments: added_tester_code
>
>
> A common problem in Wicket is that people forget to put everything in the WebPage objects on 'transient'. This will cause memory-problems. In our current project I added a little bit of code to a testclass that extends the WicketTester that takes care of this problem.
> It works like this:
> When a page is loaded with the WicketTester is checks all the field the Page had. If the field implements the IModel interface its ok. If the field has transient its also fine. But if there are fields that have neither it will fail the test. This way programmers are forced to make the field transient.
> Because sometimes fields need to be serialized without being IModels I also added a @SkipSerializableCheck annotation.
> This forces programmers using Wicket to think about serialization and they have to add a annotation to make is serializable instead of adding transient to make it non-serializable.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.