]> source.dussan.org Git - jgit.git/commit
ProgressMonitor: Refactor to use background alarms 15/2615/1
authorShawn O. Pearce <spearce@spearce.org>
Tue, 1 Mar 2011 03:34:06 +0000 (19:34 -0800)
committerShawn O. Pearce <spearce@spearce.org>
Tue, 1 Mar 2011 03:36:56 +0000 (19:36 -0800)
commit68ab451d3907e38f7c259ef52a9c3c6a6ee42ead
treeb64fa7dd82996af0c5c6a8780e08b1d101485c6f
parent2fba1e65e1ce5070b56fe9ef3573a6bf7b5dcf3b
ProgressMonitor: Refactor to use background alarms

Instead of polling the system clock on every update(1) method call,
use a scheduled executor to toggle a volatile once per second until
the task is done.  Check the volatile on each update(int), looking
to see if output should occur.

This limits progress output to either once per 1% complete, or once
per second.  To save time during update calls the timer isn't reset
during each 1% of output, which means we may see one unnecessary
output trigger if at least 1% completed during the one second of the
alarm time.

Change-Id: I8fdd7e31c37bef39a5d1b3da7105da0ef879eb84
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
org.eclipse.jgit.pgm/src/org/eclipse/jgit/pgm/Diff.java
org.eclipse.jgit/src/org/eclipse/jgit/lib/BatchingProgressMonitor.java [new file with mode: 0644]
org.eclipse.jgit/src/org/eclipse/jgit/lib/TextProgressMonitor.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/SideBandProgressMonitor.java