Re: Problems with singletons

31 views
Skip to first unread message

Christian Goudreau

unread,
May 31, 2012, 10:01:53 AM5/31/12
to gwt-pl...@googlegroups.com
Is it binded with: bindSingletonPresenterWidget?

On Wed, May 30, 2012 at 8:31 PM, ricardo <ricardol...@gmail.com> wrote:
i have a presenterwidget that is singleton but if u refresh the
browser i see that another instance of presenterwidget is created, can
someone explain me how the scope singleton works on gwtp.



--
Christian Goudreau

ricardo larrahondo genoy

unread,
May 31, 2012, 10:14:00 AM5/31/12
to gwt-pl...@googlegroups.com
yes

2012/5/31 Christian Goudreau <goudreau....@gmail.com>

Christian Goudreau

unread,
May 31, 2012, 10:19:46 AM5/31/12
to gwt-pl...@googlegroups.com
Well, a singleton in a web application live until you refresh the browser and will be created again afterward since you're browser reload the java script and clean everything that was in memory.

The concept of a singleton only apply to in-memory objects and is short lived. If you want to persist something longer than that's it's not a Singleton anymore, but a serialized object shared and synchronized. You should look at cookies and local storage to do that.

Cheers,
--
Christian Goudreau

ricardo larrahondo genoy

unread,
May 31, 2012, 3:44:29 PM5/31/12
to gwt-pl...@googlegroups.com
thank you. :D

2012/5/31 Christian Goudreau <goudreau....@gmail.com>
Reply all
Reply to author
Forward
0 new messages