]> source.dussan.org Git - jgit.git/commit
Make GC cancellable when called programmatically 00/89600/6
authorHector Caballero <hector.caballero@ericsson.com>
Thu, 26 Jan 2017 16:24:49 +0000 (11:24 -0500)
committerDavid Pursehouse <david.pursehouse@gmail.com>
Mon, 30 Jan 2017 00:14:37 +0000 (20:14 -0400)
commit27b710c394d448f1833a44cad1aff21033f5ccd4
tree1c9bb8ec4f3a8343bc7840c62ef9e083a635f099
parent53ad4373825f444bc011d046e0acd3dfe5eaeca7
Make GC cancellable when called programmatically

Sometimes, it is necessary to cancel a garbage collection operation.
When GC is called using the standalone executable, i.e., from a command
line, Control-Cing the process does the trick. When calling GC
programmatically, though, there is no mechanism to do it.

Add checks in the GC process so that a custom cancellable progress
monitor could be passed in order to cancel the operation at specific
points. In this case, the calling process set the cancel flag in the
progress monitor and the GC process will throw an exception that can
be caught and handled by the caller accordingly.

Change-Id: Ieaecf3dbdf244539ec734939c065735f6785aacf
Signed-off-by: Hector Caballero <hector.caballero@ericsson.com>
org.eclipse.jgit/src/org/eclipse/jgit/errors/CancelledException.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/internal/storage/file/GC.java