connection check

View: New views
2 Messages — Rating Filter:   Alert me  

connection check

by Jason Tian :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello:

I am trying to update some files from svn everytime when my program starts up.

I was wondering is there any simple way that can check if svn server is available or not.

so that the program will skip the "update" step if server is down.

Thank you.

Re: connection check

by Alexander Kitaev-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello Jason,

With "low-level" API (i.e. SVNRepository) you may use
SVNRepository.testConnection() method.

If you'd like to take advantages of the higher level API, the you may
use SVNWCClient.doInfo(url, SVNRevision.HEAD, SVNRevision.HEAD) - using
repository root URL as a parameter. You have to make sure that you do
have read access to repository root, otherwise you may get
SVNAuthenticationException on doInfo(...) call.

Another problem might be timeout - in certain cases call to doInfo or
testConnection() may take long time and then fail with timeout
exception. You could nothing about it, but you may change timeout values
by extending DefaultSVNAuthenticationManager and overriding
getReadTimeout and getConnectTimeout methods. Then use this
authentication manager either for SVNRepository or with SVNClientManager.

Alexander Kitaev,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!
http://sqljet.com/ - Java SQLite Library!

Jason Tian wrote:

> Hello:
>
> I am trying to update some files from svn everytime when my program starts
> up.
>
> I was wondering is there any simple way that can check if svn server is
> available or not.
>
> so that the program will skip the "update" step if server is down.
>
> Thank you.

---------------------------------------------------------------------
To unsubscribe, e-mail: svnkit-users-unsubscribe@...
For additional commands, e-mail: svnkit-users-help@...