Hello,
> 1.create(SVNUrl)
> 2.create(SVNUrl,ISVNSession)
Second version allows one to parametrize SVNRepository with
an
ISVNSession instance. ISVNSession has the following methods
that will be
called by SVNRepository:
public boolean keepConnection(SVNRepository repository);
Default is "true", that means that socket open by
SVNRepository will
remain open after SVNRepository method is completed. If
you'll return
"false" in that method, socket will be closed. In
case of svn+ssh
connection, socket (ssh connection) will remain open, but
ssh "channel"
(remote svnserve process) will be closed. It makes sense to
keep
connection open, because latest versions of svnserve could
be reused by
subsequent operations and there is no need to close the
socket or
channel. Of course, this method is not called when
"file" protocol is used.
Other methods of ISVNSession allows you to keep local cache
of commit
messages fetched from repository with:
public abstract SVNDirEntry getDir(String path, long
revision, boolean
includeCommitMessages, Collection entries) throws
SVNException;
Default getDir method doesn't fetch commit messages, but
this one could
do that. Fetching last commit messages for directory entries
is
expensive and that is why they are cached in ISVNSession
instance.
> If i connect to the repository using the 1 method then
how should i close
> the connection?
> For the second method is it correct to close the
session using
closeSession
> method?
No, passing ISVNSession makes no difference. Actually when
you're not
passing ISVNSession, default one is used. Calling
closeSession will
explicitly close connection in case it is still open. One
have to call
this method when SVNRepository object should be disposed
(i.e. it is not
planned to be used again).
> Can anyone suggest how to establish a single
connection for mutiple users
> and also different connection for each of them!!
The main rule is that SVNRepository is not thread safe. So,
single
instance of SVNRepository should be used only from the same
thread. To
have multiple connections you should create multiple
SVNRepository'ies.
With svn+ssh connection single SSH connection will be shared
between
repositories though (in case all repositories connects to
the same host
with the same SSH credentials).
You also may reuse repositories using
SVNRepository.setLocation method,
however, setLocation shouldn't change access protocol.
Alexander Kitaev,
TMate Software,
http://svnkit.com/ - Java
[Sub]Versioning Library!
archana_sam wrote:
> hi all,
>
> I want to know the differnce between the following
methods in SVNRepository:
>
> 1.create(SVNUrl)
> 2.create(SVNUrl,ISVNSession)
>
> I also would like to know more about sessions in svn. I
want to know the
> diiferrence between connecting to the repository just
by using the url alone
> and that of connecting to the repository using
sessions.
>
> If i connect to the repository using the 1 method then
how should i close
> the connection?
> For the second method is it correct to close the
session using closeSession
> method?
>
> Can anyone suggest how to establish a single connection
for mutiple users
> and also different connection for each of them!!
>
> Thanking you!!
>
> Regards,
> Archana.
>
>
------------------------------------------------------------
---------
To unsubscribe, e-mail: svnkit-users-unsubscribe svnkit.com
For additional commands, e-mail: svnkit-users-help svnkit.com
|