• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is DatabaseServerLogin Module threadsafe?

 
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have extended DatabaseServerLoginModule


at (1)CustomerVO is populate with values from Database table.
at (2) for invlaid Login CustomerVO's property is changed.

What happens when 2 users login at the same time ?
Are those requests handled by 2 different objects of MyLoginModule or only one?
Want to know if it is good/bad idea to use member VO in this case?

Thanks in advance
 
Ranch Hand
Posts: 1209
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As a client you typically call the login() on theLoginContext that in turn invokes login() on the configured stack of LoginModules.

LoginContext javadoc -

However, a LoginContext should not be used to authenticate more than one Subject. A separate LoginContext should be used toauthenticate each different Subject.

LoginModule javadoc -

The LoginContext is responsible for reading the Configuration and instantiating the appropriate LoginModules.


So, assuming that you create LoginContext instance when somebody accesses it and that its ThreadSafe (you dont hold on to it after the method call etc), then every instantiation of LoginContext s'd result in the LoginModule getting instantiated . I just checked the LoginContext code, it seems to be instantiating the LoginModule everytime the LoginContext is instantiated.
So if the login() is in the same method call, i think you s'd be ok. The LoginContext would be per thread and so would be the login module.


[ July 21, 2005: Message edited by: Karthik Guru ]
 
Meg Adal
Ranch Hand
Posts: 70
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for reply
 
I guess I've been abducted by space aliens. So unprofessional. They tried to probe me with this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic