manifoldcf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alessandro Benedetti <abenede...@apache.org>
Subject [Repository Connector] Singleton APIConnection
Date Fri, 01 May 2015 14:09:09 GMT
Hi guys !
While developing a custom Repository connector I was using this approach
for a Singleton APIConnection :

public class CustomRepositoryConnector
        extends BaseRepositoryConnector{

...

protected BoxSession session ;

...

protected void getSession()
        throws ManifoldCFException {
    if (session == null) {
            session = new BoxSession(clientId, clientSecret, username,
password);

    }
}

}


Debugging a little bit I noticed that actually the BoxSession is
instantiated a lot of times during the Job and not only one !

Analyzing the scenario it seems a Session is instantiated every time a
new Repository connection is pulled from a connection pool ( during
the job execution) .

Is it not possible to use only one session for the entire job ?

Is it necessary to get the session only the the "check" and "connect"
method, or inside each of the functional methods ? ( like
addSeedDocument, processSeedsDocuments ext ext )


Cheers




-- 
--------------------------

Benedetti Alessandro
Visiting card : http://about.me/alessandro_benedetti

"Tyger, tyger burning bright
In the forests of the night,
What immortal hand or eye
Could frame thy fearful symmetry?"

William Blake - Songs of Experience -1794 England

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message