DFC Session Management Whitepaper
DFC Session Management Whitepaper
DFC Session Management Whitepaper
Abstract: This document highlights the nuances of DFC session management from the client
application perspective.
Date 3/11/2007
Copyright © 2007 EMC Corporation. All rights reserved.
EMC believes the information in this publication is accurate as of its publication date. The information is subject to change without
notice.
THE INFORMATION IN THIS PUBLICATION IS PROVIDED “AS IS.” EMC CORPORATION MAKES NO
REPRESENTATIONS OR WARRANTIES OF ANY KIND WITH RESPECT TO THE INFORMATION IN THIS PUBLICATION,
AND SPECIFICALLY DISCLAIMS IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
PURPOSE.
Use, copying, and distribution of any EMC software described in this publication requires an applicable software license.
EMC2, EMC, and EMC Documentum product names are trademarks of EMC Corporation. All other trademarks used herein are the
property of their respective owners. All other brand names are trademarks or registered trademarks of their respective owners.
Session Manager manages sessions with one or more repositories. Session manager is used by the client
applications to retrieve sessions and release them back when they are done using the session.
SessionManager also maintains a pool of DMCL sessions and allocates them to the DFC sessions when
requested. DFC Session should be obtained through Session Manager rather than directly getting them
using IDfClient object.
Session manager also works properly if the connection pooling is turned off but is inefficient.
You can get sessions from Session manager by using either getSession or newSession method on the
IDfSessionManager interface. getSession returns an existing DMCL session from the connection pool if
one exists or creates a new session is no free DMCL sessions are available. newSession creates a new
DMCL session and returns irrespective of whether there is a free connection or not. Shared session returned
by the getSession method reduce the resources your application uses. But at the same time one has to be
careful as two threads referencing the same repository object obtained from the same session get reference
to the same object and modifying it one thread will cause the cause the object to change in the other thread
even though nothing has been modified in the second thread.
It should be noted that DFC pooling is different from DMCL pooling and release of DfSession does not
invoke dmcl disconnect immediately but after certain period of inactivity.
Session manager transactions do not use a two-phase commit algorithm, and they rely on the transaction
facilities of the underlying databases. As a result, a multi-repository transaction can fail after the system has
committed the transaction in one of the repositories. For example, if there are three repositories, and the
first two commit successfully, but the third does not, the session manager cannot undo the already
committed transactions on the first two repositories.
Session Transaction and Session Manager Transaction are different. IDfSession interface has beginTrans
method that corresponds to the explicit database transaction. Note that any changes that you save or check
in are not committed to a repository until you call the commitTrans method. You can cancel the database
transaction by calling the abortTrans method.
IDfSessionManager has beginTransaction method to start the Session manager transactions. This method
starts a new managed transaction. Only sessions obtained after the call to beginTransaction method will be
able to participate in the transaction. Session objects obtained before beginTransaction will not be able to
participate in the transaction. You can commit the transaction by using the commitTransaction method or
abort the transaction by calling the abortTransaction method.
• Open log4j.properties file located under $DOCUMENTUM\config directory and add the
following lines at the end. These entries with direct the logs for session leaks into
sessLeakDetector.log.
log4j.logger.com.documentum.fc.client.DfSessionLeakChecker=
ERROR,SESS_LEAK_DETECT
log4j.appender.SESS_LEAK_DETECT=org.apache.log4j.RollingFil
eAppender
log4j.appender.SESS_LEAK_DETECT.File=C\:/Documentum/logs/se
ssLeakDetector.log
log4j.appender.SESS_LEAK_DETECT.MaxFileSize=100MB
log4j.appender.SESS_LEAK_DETECT.MaxBackupIndex=5
log4j.appender.SESS_LEAK_DETECT.layout=org.apache.log4j.Pat
ternLayout
log4j.appender.SESS_LEAK_DETECT.layout.ConversionPattern=%d
{ABSOLUTE} [%t] %m%n
log4j.logger.com.documentum.fc.client.DfSessionManagerPool=
DEBUG,SESS_LEAK_DETECT
log4j.logger.com.documentum.fc.client.DfSessionmanager=DEBU
G,SESS_LEAK_DETECT
log4j.logger.com.documentum.fc.client.DfDisposableCollectio
n=DEBUG,SESS_LEAK_DETECT
log4j.appender.SESS_LEAK_DETECT=org.apache.log4j.RollingFil
eAppender
log4j.appender.SESS_LEAK_DETECT.File=C\:/Documentum/logs/se
ssLeakDetector.log
log4j.appender.SESS_LEAK_DETECT.MaxFileSize=100MB
log4j.appender.SESS_LEAK_DETECT.MaxBackupIndex=5
log4j.appender.SESS_LEAK_DETECT.layout=org.apache.log4j.Pat
ternLayout
log4j.appender.SESS_LEAK_DETECT.layout.ConversionPattern=%d
{ABSOLUTE} [%t] %m%n
Below is a sample session leak which gives you. The stack trace will tell you the exact class from which the
leak originated
This mode is used to diagnose session related issues. It can impact performance and should be preferably
used on development/test systems instead of production systems.
SessionListener
Once you have the session listener class, you need to set this class as listener to the SessionManager by
using IDfSessionManager.setListener(…) method.
Below is a simple implementation of the session listener that prints out at every session creation and
destruction.
static class SessionListenerImpl implements IDfSessionManagerEventListener
{
public void onSessionCreate(IDfSession sess) throws DfException {
System.out.println("Session created: " + sess.getSessionId());
Orphaned Objects
Orphaned objects are objects obtained from a session that has already been released back to the DFC
session manager. Support for detection of orphaned objects was added in DFC 5.3. Orphaned objects can
be detected by enabling DFC session diagnostics. This will become more complex if there are multithread
applications where objects are passed around. Keeping this in mind, it is advised no to the object instance
after the session is released and if the object needs to be passed around, you should be passing the IDfId
and then use this id to get the object again by using IDfSession.getObjectById(…).
How Do I Section
1. How to get a DFC session and release it back to the pool.
The following code snippet give you the basic steps needed to get a session, use it and release it
back to the pool.
try {
//get the IDFsession instance by using getSession or newSession
Session = sMgr.getSession(<docbase>);
}finally{
//release the session
sMgr.release(session);
}
2. How do I assign the same user access credentials to all the repositories?
You can assign the same user credentials to all the repositories in one step instead of
using IDfsessionManager setIdentity method for each of the repositories by proving a ‘*’
instead of the repository name in the setIdentity method.
sMgr.setIdentity( * , loginInfoObj );
3. How do I get a new new/fresh session from the repository instead of getting one from the session
pool?
You can get a new session from the repository by using IDfSessionManager’s
newSession method instead of getSession method.
You can turn of connection pooling so that every time a session is requested, a new
repository session is created by setting the ‘connect_pooling_enabled’ property in the dmcl.ini
file to ‘F’.
5. How do I make DFC to disconnect the DMCL session immediately after releasing the session?
You can achieve this by including ‘DebugSessionManager’ option in the JVM startup of
the client program. This causes the session manager to disconnect sessions as soon as you
The default timeout for an inactive dmcl session is 5 minutes. To change this, modify
the ‘client_session_timeout’ key in the server.ini file. The server needs to be restarted for this
change to take affect.
7. How do I configure that each DMCL session is only used for maximum n number of times?
8. How do I configure the maximum number of sessions a client can open with the repository?
By default only 10 sessions are allowed per client. To change this, modify the
max_session_count key in the dmcl.ini file. The client needs to be restarted for this to take
affect.
9. How do I configure the maximum number of concurrent sessions allowed for all the clients
combined for a repository?
By default maximum concurrent sessions on the server are limited to 100. To change
this, modify the concurrent_sessions key in the server.ini file. The server needs to be started
for this to take affect.
You can handle transaction by using the transaction capability of the Session manager.
The following code snippet gives you the template to use transactions. Remember that only the
sessions obtained after the beginTransaction will participate in the transaction.
try {
//start the transaction
sMgr.beginTransaction();
//perform actions
…….
}catch(exception ex){
//handle exception
……
From DFC 4.2.7 onwards, all the calls on IDfSession and IDfSessionManager are
synchronized. Hence calls on the IDfSession and IDfSessionManager should be thread safe.
Currently there is no way to tell if a DFC session is active or if the session expired.
Even though the current session expires by the server, new session shall be created if the
DFC application tries to query using the original session identifier (q0, q1 etc).
IDfSession.isConnected method returns always true whether the session is alive or timed out
unless the session is disconnected by IDfSession.disconnect().
Challenge Questions
1) What are the requirements for a DfSession to participate in a SessionManager
transaction?
2) How do you write a custom code that depends on when the a new session is
created or destroyed.?
3) How to make DFC disconnect the dmcl connection immediately after release?
4) How to get a session for another user when logged in as a different user?
5) How do get a session in WDK application?
6) How to know about the number of active sessions with SessionManager?
About EMC
EMC Corporation (NYSE: EMC) is the world leader in information storage systems, software, networks,
and services, providing automated networked storage solutions to help organizations get the maximum
value from their information, at the lowest total cost, across every point in the information lifecycle.
Information about EMC’s products and services can be found at www.EMC.com