Assuming this is on the client side, each refresh gets its own ClassLoader. So, you won't be able to persist state on the client across a refresh this way. The VM is not spun up again, but the effect is similar for this use case.
On Wed, Sep 22, 2010 at 12:34 PM, Moshe Solomon <[email protected]> wrote: > I'm not sure if this is because of the GWT plugin, but maybe you guys > know... > > I have a Singleton class which I use to store the user authentication. > But When I reload my page (with F5) the singleton is reloaded, as if > the VM is restarted. > > public class AuthenticationManager { > > private static final AuthenticationManager m_instance = new > AuthenticationManager(); > > private boolean m_authenticated = false; > > private AuthenticationManager() { > System.out.println("AuthenticationManager Constructor"); > } > > public static AuthenticationManager getInstance() { > return m_instance; > } > > public boolean isAuthenticated() { > return m_authenticated; > } > > public boolean authenticate(String uid, String pwd) { > if (uid != null && uid.trim().length() > 0) { > if (pwd != null && pwd.trim().length() > 0) { > return (m_authenticated = true); > } > } > return false; > } > } > > -- > You received this message because you are subscribed to the Google Groups > "Google Web Toolkit" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<google-web-toolkit%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/google-web-toolkit?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
