manifoldcf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Karl Wright <daddy...@gmail.com>
Subject Re: [Repository Connector] Singleton APIConnection
Date Fri, 01 May 2015 14:30:30 GMT
Hi Alessandro,

The connection pooling model is very well defined and has been since Day
One.  Each connection instance operates independently.  There is a chapter
in the book about it in fact.

Karl


On Fri, May 1, 2015 at 10:09 AM, Alessandro Benedetti <abenedetti@apache.org
> wrote:

> 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