Hi,

Just a little background, i've been trying to get my application clustered
with terracotta for a while and ran into a big problem.  Basically wicket
was producing more garbage objects than terracotta could handle, as such
terracotta was using up loads of disk space (see my thread on terracotta
forum for more info http://forums.terracotta.org/forums/posts/list/1144.page
)
To solve this I have decided to try and stop the page object being stored
'as is' to avoid the number of objects being sent to the terracotta server.
My solution has been to replace the default IPageMapEntry with one that only
stores a serialized version of the page:

public class NewPageMapEntry extends AbstractPageMapEntry
{
        private transient Page page;
        private byte[] data;
        
        public NewPageMapEntry(final Page page)
        {
                this.page = page;
                
                data = Objects.objectToByteArray(page);
                
                setNumericId(page.getNumericId());
        }
        
        @Override
        public Page getPage()
        {
                if(this.page == null)
                {
                        page = (Page) Objects.byteArrayToObject(data);
                }
                return page;
        }
}

and use it in my base page (which all others extend) like this:

        @Override
        public IPageMapEntry getPageMapEntry()
        {
                return new NewPageMapEntry(this);
        }

Does this seem like a reasonable approach?
-- 
View this message in context: 
http://www.nabble.com/Please-check-my-fix-to-terracotta-problem-tp17864318p17864318.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to