You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@manifoldcf.apache.org by Alessandro Benedetti <ab...@apache.org> on 2015/05/13 11:43:39 UTC

[Respository Connector] Connections

Hi guys,
just wondering around the pool of connections in a  repository connector.
In my Repo Connector I have a getSession method of this kind :

"*if (session == null) {*









*    ...    try {        session = new BoxSession(clientId,
clientSecret, username, password);    } catch (RuntimeException e) {
     throw new ManifoldCFException("[Box Session] Manifold Exception :
",e);    }...    lastSessionFetch = System.currentTimeMillis();}*"

This method is called in the :


   - processDocuments(...)
   - getDocumentVersions(...)
   - addSeedDocuments(...)
   - connect()
   - check()

Because of the null check, a new BoxSession will be created only one
time per Repository Connection ( I guess) .

In my Repository Connector configuration I set *"Max Connections" = 10.*

1)Does this mean that every time a Job involving that connector will
run, will open a max of 10 concurrent repository connections ?

2)Or this is extra job ? i.e. in the entire system, indepentendly of
how many jobs are there for that connector , we will have a total of N
Connections for that Repository ?

If I understood the documentation, I would say (2)

So if I execute the Job every 5 minutes, in an hour I will try to get
120 Box Session ?
If I understood well this should be the expected behaviour.
Can happen that actually we open much more sessions ?

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

Re: [Respository Connector] Connections

Posted by Alessandro Benedetti <be...@gmail.com>.
Thanks Karl,
I have this indeed :

"public void disconnect()

        throws ManifoldCFException {
    if (session != null) {
        session.close();
        session = null;
        lastSessionFetch = -1L;
    }
    this.clientId = null;
    this.clientSecret = null;
    this.username = null;
    this.password = null;

}"

We are using ManifoldCF 1.8 so the documentation is valid :)

Thank you very much !

2015-05-13 10:56 GMT+01:00 Karl Wright <da...@gmail.com>:

> Hi Alessandro,
>
> You should also have in your connector code, for the method disconnect(),
> the following:
>
> session = null;
>
> This guarantees that the number of sessions is limited to the number of
> connected connections.
>
> As for the total number, as of MCF 1.5 these are tracked across cluster
> members.  So when you set a maximum number of connections to 10, that means
> there will be no more than 10 active sessions, for all processes in the
> cluster, including the UI.
>
> Before MCF 1.5, no cross-cluster connection limits were enforced, so
> documentation from earlier may say the wrong thing.
>
> Thanks,
> Karl
>
>
> On Wed, May 13, 2015 at 5:43 AM, Alessandro Benedetti <
> abenedetti@apache.org
> > wrote:
>
> > Hi guys,
> > just wondering around the pool of connections in a  repository connector.
> > In my Repo Connector I have a getSession method of this kind :
> >
> > "*if (session == null) {*
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > *    ...    try {        session = new BoxSession(clientId,
> > clientSecret, username, password);    } catch (RuntimeException e) {
> >      throw new ManifoldCFException("[Box Session] Manifold Exception :
> > ",e);    }...    lastSessionFetch = System.currentTimeMillis();}*"
> >
> > This method is called in the :
> >
> >
> >    - processDocuments(...)
> >    - getDocumentVersions(...)
> >    - addSeedDocuments(...)
> >    - connect()
> >    - check()
> >
> > Because of the null check, a new BoxSession will be created only one
> > time per Repository Connection ( I guess) .
> >
> > In my Repository Connector configuration I set *"Max Connections" = 10.*
> >
> > 1)Does this mean that every time a Job involving that connector will
> > run, will open a max of 10 concurrent repository connections ?
> >
> > 2)Or this is extra job ? i.e. in the entire system, indepentendly of
> > how many jobs are there for that connector , we will have a total of N
> > Connections for that Repository ?
> >
> > If I understood the documentation, I would say (2)
> >
> > So if I execute the Job every 5 minutes, in an hour I will try to get
> > 120 Box Session ?
> > If I understood well this should be the expected behaviour.
> > Can happen that actually we open much more sessions ?
> >
> > 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
> >
>



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

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

Re: [Respository Connector] Connections

Posted by Karl Wright <da...@gmail.com>.
Hi Alessandro,

You should also have in your connector code, for the method disconnect(),
the following:

session = null;

This guarantees that the number of sessions is limited to the number of
connected connections.

As for the total number, as of MCF 1.5 these are tracked across cluster
members.  So when you set a maximum number of connections to 10, that means
there will be no more than 10 active sessions, for all processes in the
cluster, including the UI.

Before MCF 1.5, no cross-cluster connection limits were enforced, so
documentation from earlier may say the wrong thing.

Thanks,
Karl


On Wed, May 13, 2015 at 5:43 AM, Alessandro Benedetti <abenedetti@apache.org
> wrote:

> Hi guys,
> just wondering around the pool of connections in a  repository connector.
> In my Repo Connector I have a getSession method of this kind :
>
> "*if (session == null) {*
>
>
>
>
>
>
>
>
>
> *    ...    try {        session = new BoxSession(clientId,
> clientSecret, username, password);    } catch (RuntimeException e) {
>      throw new ManifoldCFException("[Box Session] Manifold Exception :
> ",e);    }...    lastSessionFetch = System.currentTimeMillis();}*"
>
> This method is called in the :
>
>
>    - processDocuments(...)
>    - getDocumentVersions(...)
>    - addSeedDocuments(...)
>    - connect()
>    - check()
>
> Because of the null check, a new BoxSession will be created only one
> time per Repository Connection ( I guess) .
>
> In my Repository Connector configuration I set *"Max Connections" = 10.*
>
> 1)Does this mean that every time a Job involving that connector will
> run, will open a max of 10 concurrent repository connections ?
>
> 2)Or this is extra job ? i.e. in the entire system, indepentendly of
> how many jobs are there for that connector , we will have a total of N
> Connections for that Repository ?
>
> If I understood the documentation, I would say (2)
>
> So if I execute the Job every 5 minutes, in an hour I will try to get
> 120 Box Session ?
> If I understood well this should be the expected behaviour.
> Can happen that actually we open much more sessions ?
>
> 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
>