Hi,
I have the following code snippet
session = NotesFactory.createSession(server, user, password);
while(true) {
if(isSessionValid()) {
//do something
} else {
//login again
session = NotesFactory.createSession(server, user, password);
}
}
In the above scenario, how can i implement the method isSessionValid()?
I believe there is a method session.isValid() but this is not available on all versions from 5.x to 8.x
Is there a way to check if existing session is valid?
Regards,
Priya
Subject: Idea…
session=NotesFactory.createSession(server, user, password);try {
session.createName(“somename”).recycle();
} catch(Exception e) {
session = NotesFactory.createSession(server, user, password);
try {
session.createName("somename").recycle();
} catch(Exception f) {
// Process a failure and exit
}
}
// session is valid now - do whatever
-
If this doesn’t work try a different method on session that interacts with the server. I selected “createName” out of the blue, literally. The intent is to attempt to use the session and see if it fails, rather than create a name.
-
Hope this helps…