public default String getProgressDescription() { return progressIndicator().apply(this); }
public default String getProgressDescription() { return progressIndicator().apply(this); }
@Override public Pack build() { final java.util.function.Function<ProgressListener, String> oldIndicator = progress .progressIndicator(); progress.setProgressIndicator((p) -> String .format("Server: resolving missing commits... %,d", (int) p.getProgress())); progress.started(); LinkedHashMap<RefRequest, List<ObjectId>> missingCommits; try { // byte[] byteArray = ByteStreams.toByteArray(in); // in.close(); // this.in = new DataInputStream(new ByteArrayInputStream(byteArray)); packIO.readHeader(in); missingCommits = readRefsCommits(); } catch (Exception e) { e.printStackTrace(); try { in.close(); } catch (IOException ex) { } throw propagate(e); } progress.complete(); progress.setProgressIndicator(oldIndicator); return new StreamingPack(missingCommits, in); }
private void applyIndex(PackProcessor target, RefRequest req, Deduplicator deduplicator, ProgressListener progress) { progress.setDescription("Updating spatial indexes for " + req.name); ObjectReporter objectReport = new ObjectReporter(progress); // back up current progress indicator final Function<ProgressListener, String> defaultProgressIndicator; defaultProgressIndicator = progress.progressIndicator(); // set our custom progress indicator progress.setProgressIndicator((p) -> objectReport.toString()); final List<IndexDef> indexes = missingIndexes.get(req); checkNotNull(indexes); final IndexDatabase sourceStore = source.indexDatabase(); try { final Stopwatch sw = Stopwatch.createStarted(); for (IndexDef def : indexes) { target.putIndex(def, sourceStore, objectReport, deduplicator); } progress.complete(); if (objectReport.total.get() > 0) { progress.started(); String description = String.format("Indexes updated: %,d, repeated: %,d, time: %s", objectReport.inserted(), objectReport.found(), sw.stop()); progress.setDescription(description); } } finally { // restore previous progress indicator progress.setProgressIndicator(defaultProgressIndicator); } }
defaultProgressIndicator = progress.progressIndicator();
defaultProgressIndicator = progress.progressIndicator();
defaultProgressIndicator = progress.progressIndicator();
final ProgressListener progress = getProgressListener(); java.util.function.Function<ProgressListener, String> oldIndicator = progress .progressIndicator();
final ProgressListener progress = getProgressListener(); java.util.function.Function<ProgressListener, String> oldIndicator = progress .progressIndicator();