Home > Discussion Forum dm_developer Discussion Forum

Go Back   dm_developer Discussion Forum > Documentum Products > Documentum 6

Reply
 
Thread Tools Display Modes
  #1  
Old February 8, 2010, 09:03 PM
ank ank is offline
Registered User
 
Join Date: Aug 2009
Posts: 110
Correct way of making session

In my DFC 6.5SP1 application this is how I am making and releasing a session


Code:
public boolean folderExists(String folderName, String path) {
 IDfSessionManager smgr = null;
 IDfSession session = null;
 try {
        smgr = DFCUtil.newInstance().getSessionManager();
    session = DFCUtil.newInstance().getDocbaseSession(smgr);   
    IDfFolder folder = session.getFolderByPath(path);
    if(folder != null) {
   folderExists = true;
    } 
   } catch (DfException dfe) {
   DfLogger.error(this, "Path :  "+path, null, dfe);
   throw new RuntimeException(dfe);
   } finally {
   if(smgr != null && session != null) {
      smgr.release(session);
    }
    } 
  
  return folderExists;
 }
Code:
public IDfSessionManager getSessionManager() {
    
      IDfClientX clientx =null;
      IDfClient client=null;
      IDfSessionManager smgr = null;
      try {
       clientx=new DfClientX(); 
       client=clientx.getLocalClient();
       smgr=client.newSessionManager();
      }catch(Exception e) {  
       throw new RuntimeException(e);
      }
      return smgr;
     }
Code:
public IDfSession getDocbaseSession(IDfSessionManager smgr){
 RegistryPasswordUtils putils = new RegistryPasswordUtils();
 IDfLoginInfo logininfo=null;
   IDfClientX clientx =null;  
   String lsUserName = null;
   String lsPassword = null;
   String lsDocbaseName = null;
      lsUserName = PropertyReaderFactory.getInstance().getProperties().getProperty("username");
      
      lsPassword = PropertyReaderFactory.getInstance().getProperties().getProperty("password");
      
      lsDocbaseName = PropertyReaderFactory.getInstance().getProperties().getProperty("repository");
      
   
   IDfSession loSession = null;
   try {
    clientx=new DfClientX(); 
    logininfo=clientx.getLoginInfo();
    logininfo.setUser(lsUserName);
    logininfo.setPassword(putils.decrypt(lsPassword));
  
    smgr.setIdentity(lsDocbaseName, logininfo);
    smgr.authenticate(lsDocbaseName);
    loSession=smgr.getSession(lsDocbaseName);    
   } catch (DfException e) {
    throw new RuntimeException(e);
   }
 
   return loSession;
  }
The problem I am facing is that when multiple users concurrently access the application (during load testing), it gives "error during session construction" error.

For single user it works fine.

It made me wonder if I am not creating/releasing the session correctly.

Thank you
Reply With Quote
  #2  
Old February 8, 2010, 10:06 PM
johnnygee_va johnnygee_va is offline
Registered User
 
Join Date: Jun 2003
Location: Washington DC
Posts: 3,971
You shouldnt be retrieving logininfo from the client, you instantiate a new instance:

logininfo = new DfLoginInfo ();
__________________
__________________
Johnny Gee
Principal Architect
Beach Street Consulting
Blog: http://johnnygee.wordpress.com
Reply With Quote
  #3  
Old February 9, 2010, 12:07 AM
ank ank is offline
Registered User
 
Join Date: Aug 2009
Posts: 110
Quote:
Originally Posted by johnnygee_va View Post
You shouldnt be retrieving logininfo from the client, you instantiate a new instance:

logininfo = new DfLoginInfo ();
Thanks a lot.

Does that mean, this is not required at all.

clientx=new DfClientX();

since I see no other place where this is used.

thank you
Reply With Quote
  #4  
Old February 9, 2010, 06:35 AM
johnnygee_va johnnygee_va is offline
Registered User
 
Join Date: Jun 2003
Location: Washington DC
Posts: 3,971
Its used to get sessionmanager, but its not needed for logininfo.
__________________
__________________
Johnny Gee
Principal Architect
Beach Street Consulting
Blog: http://johnnygee.wordpress.com
Reply With Quote
  #5  
Old February 9, 2010, 08:17 PM
ank ank is offline
Registered User
 
Join Date: Aug 2009
Posts: 110
Quote:
Originally Posted by johnnygee_va View Post
Its used to get sessionmanager, but its not needed for logininfo.
Thanks Johnny.

I'll change that as suggested.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off



All times are GMT -5. The time now is 03:08 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.