This discussion is archived
0 Replies Latest reply: Aug 17, 2012 5:40 PM by 956484 RSS

Singleton implementation for Subject

956484 Newbie
Currently Being Moderated
Can the singleton pattern be applied for
javax.security.auth.Subject ?
I am using the below code

Subject authSubject = null;
authSubject = Security.login(UserName, password);


My question is if it is okay to create the Subject as a singleton and use the same object in subsequent calls? The call Security.login will try to do a login operation. I want to not perform this operation over and over again. Is it advisable to create this object as a Singleton?

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points