Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit » Cleaning up locks on application startup(Cleaning up locks on application startup)
Cleaning up locks on application startup [message #1235512] Fri, 24 January 2014 14:55 Go to next message
Laurent Petit is currently offline Laurent PetitFriend
Messages: 21
Registered: December 2010
Junior Member
I have a server side application whose storage is backed up by JGit.

If the application crashes, or is killed, it is possible (it already happened in practice) that some lock files remain on disk, e.g. .git/refs/heads/master.lock

My question is, are there administration methods / ways, via JGit API, to cleanup this kind of false positive when the application starts up ?

I can consider just walking the .git repository and remove all *.lock files found there, but maybe it's just one of many problems that could occur when the application is killed while it was busy with jgit, and this is already handled by some jgit code ?

Thanks in advance,

--
Laurent
Re: Cleaning up locks on application startup [message #1236605 is a reply to message #1235512] Mon, 27 January 2014 16:50 Go to previous message
Matthias Sohn is currently offline Matthias SohnFriend
Messages: 612
Registered: July 2009
Senior Member
It looks like your application tried to update the master branch when it crashed. File locks are implemented by jgit's
LockFile class. You may try to get rid of stale locks caused by crashes using LockFile.unlock().

source code
https://git.eclipse.org/c/jgit/jgit.git/tree/org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/LockFile.java

javadoc
http://download.eclipse.org/jgit/docs/jgit-3.2.0.201312181205-r/apidocs/org/eclipse/jgit/internal/storage/file/LockFile.html
Previous Topic:repository stuck in Rebase w/merge
Next Topic:GitHub
Goto Forum:
  


Current Time: Fri Dec 26 05:09:52 GMT 2014

Powered by FUDForum. Page generated in 0.02032 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software