0

I'm writing an RMI application which uses swings on the client side. The user has to first login with his email and password. After his login a new JFrame is opened and based upon his email id from first ui, I should fetch data from database in the second ui.

I am new to this thing and I want to know how I can maintain sessions so that username is propagated to all JFrames. I read an article about using system properties as shown to store username:

System.setProperty("application.userName", myUserName);

I want to know whether using system properties to store email is good practice or can i maintain session in a more better way?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197

1 Answers1

0

Have the login method return a new remote object that is dedicated to that session. In fact it is that session. When the client releases the stub the session will be DGC'd, or you could provide a logout() method in the session object along with all the other methods your session needs.

user207421
  • 305,947
  • 44
  • 307
  • 483