Runnable: replace anonymous class with lambda
In Java 8 Runnable is functional interface and can be replaced with lambda expressions or method references. Change-Id: I2896b39c27b2e5a91a60149155a8c00a8eb48e39
This commit is contained in:

committed by
Shawn Pearce

parent
8f0528f3b5
commit
8785d73fa5
@@ -133,18 +133,15 @@ public class GerritServer {
|
||||
static GerritServer start(Description desc, Config baseConfig) throws Exception {
|
||||
Config cfg = desc.buildConfig(baseConfig);
|
||||
Logger.getLogger("com.google.gerrit").setLevel(Level.DEBUG);
|
||||
final CyclicBarrier serverStarted = new CyclicBarrier(2);
|
||||
final Daemon daemon =
|
||||
CyclicBarrier serverStarted = new CyclicBarrier(2);
|
||||
Daemon daemon =
|
||||
new Daemon(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
try {
|
||||
serverStarted.await();
|
||||
} catch (InterruptedException | BrokenBarrierException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
},
|
||||
Paths.get(baseConfig.getString("gerrit", null, "tempSiteDir")));
|
||||
daemon.setEmailModuleForTesting(new FakeEmailSender.Module());
|
||||
|
@@ -79,13 +79,10 @@ abstract class ChunkManager {
|
||||
cm.addLineClass(line, where, className);
|
||||
}
|
||||
undo.add(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
for (int line = start; line < end; line++) {
|
||||
cm.removeLineClass(line, where, className);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -203,33 +203,27 @@ abstract class CommentManager {
|
||||
|
||||
abstract String getTokenSuffixForActiveLine(CodeMirror cm);
|
||||
|
||||
Runnable signInCallback(final CodeMirror cm) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Runnable signInCallback(CodeMirror cm) {
|
||||
return () -> {
|
||||
String token = host.getToken();
|
||||
if (cm.extras().hasActiveLine()) {
|
||||
token += "@" + getTokenSuffixForActiveLine(cm);
|
||||
}
|
||||
Gerrit.doSignIn(token);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
abstract void newDraft(CodeMirror cm);
|
||||
|
||||
Runnable newDraftCallback(final CodeMirror cm) {
|
||||
Runnable newDraftCallback(CodeMirror cm) {
|
||||
if (!Gerrit.isSignedIn()) {
|
||||
return signInCallback(cm);
|
||||
}
|
||||
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
return () -> {
|
||||
if (cm.extras().hasActiveLine()) {
|
||||
newDraft(cm);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -268,9 +262,7 @@ abstract class CommentManager {
|
||||
abstract SortedMap<Integer, CommentGroup> getMapForNav(DisplaySide side);
|
||||
|
||||
Runnable commentNav(final CodeMirror src, final Direction dir) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
return () -> {
|
||||
// Every comment appears in both side maps as a linked pair.
|
||||
// It is only necessary to search one side to find a comment
|
||||
// on either side of the editor pair.
|
||||
@@ -312,7 +304,6 @@ abstract class CommentManager {
|
||||
cm.setCursor(Pos.create(g.getLine() - 1));
|
||||
cm.scrollToY(y - 0.5 * cm.scrollbarV().getClientHeight());
|
||||
cm.focus();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -425,27 +416,21 @@ abstract class CommentManager {
|
||||
|
||||
abstract CommentGroup getCommentGroupOnActiveLine(CodeMirror cm);
|
||||
|
||||
Runnable toggleOpenBox(final CodeMirror cm) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Runnable toggleOpenBox(CodeMirror cm) {
|
||||
return () -> {
|
||||
CommentGroup group = getCommentGroupOnActiveLine(cm);
|
||||
if (group != null) {
|
||||
group.openCloseLast();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Runnable openCloseAll(final CodeMirror cm) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Runnable openCloseAll(CodeMirror cm) {
|
||||
return () -> {
|
||||
CommentGroup group = getCommentGroupOnActiveLine(cm);
|
||||
if (group != null) {
|
||||
group.openCloseAll();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -336,7 +336,7 @@ abstract class DiffScreen extends Screen {
|
||||
handlers.clear();
|
||||
}
|
||||
|
||||
void registerCmEvents(final CodeMirror cm) {
|
||||
void registerCmEvents(CodeMirror cm) {
|
||||
cm.on("cursorActivity", updateActiveLine(cm));
|
||||
cm.on("focus", updateActiveLine(cm));
|
||||
KeyMap keyMap =
|
||||
@@ -356,9 +356,7 @@ abstract class DiffScreen extends Screen {
|
||||
.on("Shift-O", getCommentManager().openCloseAll(cm))
|
||||
.on(
|
||||
"I",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
switch (getIntraLineStatus()) {
|
||||
case OFF:
|
||||
case OK:
|
||||
@@ -369,156 +367,97 @@ abstract class DiffScreen extends Screen {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
})
|
||||
.on(
|
||||
"','",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
prefsAction.show();
|
||||
}
|
||||
})
|
||||
.on("','", prefsAction::show)
|
||||
.on(
|
||||
"Shift-/",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
new ShowHelpCommand().onKeyPress(null);
|
||||
}
|
||||
})
|
||||
.on(
|
||||
"Space",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
cm.vim().handleKey("<C-d>");
|
||||
}
|
||||
})
|
||||
.on(
|
||||
"Shift-Space",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
cm.vim().handleKey("<C-u>");
|
||||
}
|
||||
})
|
||||
.on(
|
||||
"Ctrl-F",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
cm.execCommand("find");
|
||||
}
|
||||
})
|
||||
.on(
|
||||
"Ctrl-G",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
cm.execCommand("findNext");
|
||||
}
|
||||
})
|
||||
.on("Enter", maybeNextCmSearch(cm))
|
||||
.on(
|
||||
"Shift-Ctrl-G",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
cm.execCommand("findPrev");
|
||||
}
|
||||
})
|
||||
.on(
|
||||
"Shift-Enter",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
cm.execCommand("findPrev");
|
||||
}
|
||||
})
|
||||
.on(
|
||||
"Esc",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
cm.setCursor(cm.getCursor());
|
||||
cm.execCommand("clearSearch");
|
||||
cm.vim().handleEx("nohlsearch");
|
||||
}
|
||||
})
|
||||
.on(
|
||||
"Ctrl-A",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
cm.execCommand("selectAll");
|
||||
}
|
||||
})
|
||||
.on(
|
||||
"G O",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
Gerrit.display(PageLinks.toChangeQuery("status:open"));
|
||||
}
|
||||
})
|
||||
.on(
|
||||
"G M",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
Gerrit.display(PageLinks.toChangeQuery("status:merged"));
|
||||
}
|
||||
})
|
||||
.on(
|
||||
"G A",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
Gerrit.display(PageLinks.toChangeQuery("status:abandoned"));
|
||||
}
|
||||
});
|
||||
if (Gerrit.isSignedIn()) {
|
||||
keyMap
|
||||
.on(
|
||||
"G I",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
Gerrit.display(PageLinks.MINE);
|
||||
}
|
||||
})
|
||||
.on(
|
||||
"G D",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
Gerrit.display(PageLinks.toChangeQuery("owner:self is:draft"));
|
||||
}
|
||||
})
|
||||
.on(
|
||||
"G C",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
Gerrit.display(PageLinks.toChangeQuery("has:draft"));
|
||||
}
|
||||
})
|
||||
.on(
|
||||
"G W",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
Gerrit.display(PageLinks.toChangeQuery("is:watched status:open"));
|
||||
}
|
||||
})
|
||||
.on(
|
||||
"G S",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
Gerrit.display(PageLinks.toChangeQuery("is:starred"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -700,13 +639,10 @@ abstract class DiffScreen extends Screen {
|
||||
|
||||
void setContext(final int context) {
|
||||
operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
skipManager.removeAll();
|
||||
skipManager.render(context, diff);
|
||||
updateRenderEntireFile();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -753,10 +689,8 @@ abstract class DiffScreen extends Screen {
|
||||
return line - offset;
|
||||
}
|
||||
|
||||
private Runnable openEditScreen(final CodeMirror cm) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
private Runnable openEditScreen(CodeMirror cm) {
|
||||
return () -> {
|
||||
LineHandle handle = cm.extras().activeLine();
|
||||
int line = cm.getLineNumber(handle) + 1;
|
||||
if (Patch.COMMIT_MSG.equals(path)) {
|
||||
@@ -768,7 +702,6 @@ abstract class DiffScreen extends Screen {
|
||||
} else {
|
||||
Gerrit.display(token);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -832,10 +765,8 @@ abstract class DiffScreen extends Screen {
|
||||
|
||||
abstract void operation(Runnable apply);
|
||||
|
||||
private Runnable upToChange(final boolean openReplyBox) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
private Runnable upToChange(boolean openReplyBox) {
|
||||
return () -> {
|
||||
CallbackGroup group = new CallbackGroup();
|
||||
getCommentManager().saveAllDrafts(group);
|
||||
group.done();
|
||||
@@ -849,47 +780,37 @@ abstract class DiffScreen extends Screen {
|
||||
new ChangeScreen(changeId, base, rev, openReplyBox, FileTable.Mode.REVIEW));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Runnable maybePrevVimSearch(final CodeMirror cm) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
private Runnable maybePrevVimSearch(CodeMirror cm) {
|
||||
return () -> {
|
||||
if (cm.vim().hasSearchHighlight()) {
|
||||
cm.vim().handleKey("N");
|
||||
} else {
|
||||
getCommentManager().commentNav(cm, Direction.NEXT).run();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Runnable maybeNextVimSearch(final CodeMirror cm) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
private Runnable maybeNextVimSearch(CodeMirror cm) {
|
||||
return () -> {
|
||||
if (cm.vim().hasSearchHighlight()) {
|
||||
cm.vim().handleKey("n");
|
||||
} else {
|
||||
getChunkManager().diffChunkNav(cm, Direction.NEXT).run();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Runnable maybeNextCmSearch(final CodeMirror cm) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Runnable maybeNextCmSearch(CodeMirror cm) {
|
||||
return () -> {
|
||||
if (cm.hasSearchHighlight()) {
|
||||
cm.execCommand("findNext");
|
||||
} else {
|
||||
cm.execCommand("clearSearch");
|
||||
getCommentManager().toggleOpenBox(cm).run();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -973,7 +894,7 @@ abstract class DiffScreen extends Screen {
|
||||
}
|
||||
|
||||
void reloadDiffInfo() {
|
||||
final int id = ++reloadVersionId;
|
||||
int id = ++reloadVersionId;
|
||||
DiffApi.diff(revision, path)
|
||||
.base(base.asPatchSetId())
|
||||
.wholeFile()
|
||||
@@ -986,16 +907,13 @@ abstract class DiffScreen extends Screen {
|
||||
if (id == reloadVersionId && isAttached()) {
|
||||
diff = diffInfo;
|
||||
operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
skipManager.removeAll();
|
||||
getChunkManager().reset();
|
||||
getDiffTable().scrollbar.removeDiffAnnotations();
|
||||
setShowIntraline(prefs.intralineDifference());
|
||||
render(diff);
|
||||
skipManager.render(prefs.context(), diff);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -318,47 +318,32 @@ public class Header extends Composite {
|
||||
}
|
||||
|
||||
Runnable toggleReviewed() {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
return () -> {
|
||||
reviewed.setValue(!reviewed.getValue(), true);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Runnable navigate(Direction dir) {
|
||||
switch (dir) {
|
||||
case PREV:
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
return () -> {
|
||||
(hasPrev ? prev : up).go();
|
||||
}
|
||||
};
|
||||
case NEXT:
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
return () -> {
|
||||
(hasNext ? next : up).go();
|
||||
}
|
||||
};
|
||||
default:
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {}
|
||||
};
|
||||
return () -> {};
|
||||
}
|
||||
}
|
||||
|
||||
Runnable reviewedAndNext() {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
return () -> {
|
||||
if (Gerrit.isSignedIn()) {
|
||||
reviewed.setValue(true, true);
|
||||
}
|
||||
navigate(Direction.NEXT).run();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -322,13 +322,10 @@ public class PreferencesBox extends Composite {
|
||||
prefs.tabSize(Math.max(1, Integer.parseInt(v)));
|
||||
if (view != null) {
|
||||
view.operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
int v = prefs.tabSize();
|
||||
() -> {
|
||||
int size = prefs.tabSize();
|
||||
for (CodeMirror cm : view.getCms()) {
|
||||
cm.setOption("tabSize", v);
|
||||
}
|
||||
cm.setOption("tabSize", size);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -342,11 +339,8 @@ public class PreferencesBox extends Composite {
|
||||
prefs.lineLength(Math.max(1, Integer.parseInt(v)));
|
||||
if (view != null) {
|
||||
view.operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
view.setLineLength(prefs.lineLength());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -461,12 +455,9 @@ public class PreferencesBox extends Composite {
|
||||
&& Objects.equals(mode, getSelectedMode())
|
||||
&& view.isAttached()) {
|
||||
view.operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
view.getCmFromSide(DisplaySide.A).setOption("mode", mode);
|
||||
view.getCmFromSide(DisplaySide.B).setOption("mode", mode);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -483,14 +474,11 @@ public class PreferencesBox extends Composite {
|
||||
prefs.showWhitespaceErrors(e.getValue());
|
||||
if (view != null) {
|
||||
view.operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
boolean s = prefs.showWhitespaceErrors();
|
||||
for (CodeMirror cm : view.getCms()) {
|
||||
cm.setOption("showTrailingSpace", s);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -546,16 +534,13 @@ public class PreferencesBox extends Composite {
|
||||
@Override
|
||||
public void onSuccess(Void result) {
|
||||
view.operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
if (getSelectedTheme() == newTheme && isAttached()) {
|
||||
String t = newTheme.name().toLowerCase();
|
||||
view.getCmFromSide(DisplaySide.A).setOption("theme", t);
|
||||
view.getCmFromSide(DisplaySide.B).setOption("theme", t);
|
||||
view.setThemeStyles(newTheme.isDark());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@@ -64,13 +64,10 @@ class ScrollbarAnnotation extends Widget implements ClickHandler {
|
||||
refresh =
|
||||
cmB.on(
|
||||
"refresh",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
if (updateScale()) {
|
||||
updatePosition();
|
||||
}
|
||||
}
|
||||
});
|
||||
updateScale();
|
||||
updatePosition();
|
||||
|
@@ -102,14 +102,11 @@ public class SideBySide extends DiffScreen {
|
||||
super.onShowView();
|
||||
|
||||
operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
resizeCodeMirror();
|
||||
chunkManager.adjustPadding();
|
||||
cmA.refresh();
|
||||
cmB.refresh();
|
||||
}
|
||||
});
|
||||
setLineLength(Patch.COMMIT_MSG.equals(path) ? 72 : prefs.lineLength());
|
||||
diffTable.refresh();
|
||||
@@ -209,9 +206,7 @@ public class SideBySide extends DiffScreen {
|
||||
chunkManager = new SideBySideChunkManager(this, cmA, cmB, diffTable.scrollbar);
|
||||
|
||||
operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
// Estimate initial CodeMirror height, fixed up in onShowView.
|
||||
int height = Window.getClientHeight() - (Gerrit.getHeaderFooterHeight() + 18);
|
||||
cmA.setHeight(height);
|
||||
@@ -220,7 +215,6 @@ public class SideBySide extends DiffScreen {
|
||||
render(diff);
|
||||
commentManager.render(comments, prefs.expandAllComments());
|
||||
skipManager.render(prefs.context(), diff);
|
||||
}
|
||||
});
|
||||
|
||||
registerCmEvents(cmA);
|
||||
@@ -321,9 +315,7 @@ public class SideBySide extends DiffScreen {
|
||||
@Override
|
||||
Runnable updateActiveLine(final CodeMirror cm) {
|
||||
final CodeMirror other = otherCm(cm);
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
return () -> {
|
||||
// The rendering of active lines has to be deferred. Reflow
|
||||
// caused by adding and removing styles chokes Firefox when arrow
|
||||
// key (or j/k) is held down. Performance on Chrome is fine
|
||||
@@ -335,11 +327,8 @@ public class SideBySide extends DiffScreen {
|
||||
@Override
|
||||
public void execute() {
|
||||
operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
LineHandle handle =
|
||||
cm.getLineHandleVisualStart(cm.getCursor("end").line());
|
||||
() -> {
|
||||
LineHandle handle = cm.getLineHandleVisualStart(cm.getCursor("end").line());
|
||||
if (!cm.extras().activeLine(handle)) {
|
||||
return;
|
||||
}
|
||||
@@ -350,35 +339,26 @@ public class SideBySide extends DiffScreen {
|
||||
} else {
|
||||
other.extras().clearActiveLine();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Runnable moveCursorToSide(final CodeMirror cmSrc, DisplaySide sideDst) {
|
||||
final CodeMirror cmDst = getCmFromSide(sideDst);
|
||||
if (cmDst == cmSrc) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {}
|
||||
};
|
||||
return () -> {};
|
||||
}
|
||||
|
||||
final DisplaySide sideSrc = cmSrc.side();
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
return () -> {
|
||||
if (cmSrc.extras().hasActiveLine()) {
|
||||
cmDst.setCursor(
|
||||
Pos.create(
|
||||
lineOnOther(sideSrc, cmSrc.getLineNumber(cmSrc.extras().activeLine()))
|
||||
.getLine()));
|
||||
lineOnOther(sideSrc, cmSrc.getLineNumber(cmSrc.extras().activeLine())).getLine()));
|
||||
}
|
||||
cmDst.focus();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -389,19 +369,10 @@ public class SideBySide extends DiffScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
void operation(final Runnable apply) {
|
||||
void operation(Runnable apply) {
|
||||
cmA.operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
cmB.operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
apply.run();
|
||||
}
|
||||
});
|
||||
}
|
||||
() -> {
|
||||
cmB.operation(apply::run);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -246,15 +246,12 @@ class SideBySideChunkManager extends ChunkManager {
|
||||
|
||||
@Override
|
||||
Runnable diffChunkNav(final CodeMirror cm, final Direction dir) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
return () -> {
|
||||
int line = cm.extras().hasActiveLine() ? cm.getLineNumber(cm.extras().activeLine()) : 0;
|
||||
int res =
|
||||
Collections.binarySearch(
|
||||
chunks, new DiffChunkInfo(cm.side(), line, 0, false), getDiffChunkComparator());
|
||||
diffChunkNavHelper(chunks, host, res, dir);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -88,9 +88,7 @@ class SideBySideCommentGroup extends CommentGroup implements Comparable<SideBySi
|
||||
void handleRedraw() {
|
||||
getLineWidget()
|
||||
.onRedraw(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
if (canComputeHeight() && peers.peek().canComputeHeight()) {
|
||||
if (getResizeTimer() != null) {
|
||||
getResizeTimer().cancel();
|
||||
@@ -111,7 +109,6 @@ class SideBySideCommentGroup extends CommentGroup implements Comparable<SideBySi
|
||||
});
|
||||
getResizeTimer().scheduleRepeating(5);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -75,11 +75,8 @@ class SideBySideTable extends DiffTable {
|
||||
}
|
||||
|
||||
Runnable toggleA() {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
return () -> {
|
||||
setVisibleA(!isVisibleA());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -91,12 +91,9 @@ class SkipBar extends Composite {
|
||||
}
|
||||
if (isNew) {
|
||||
lineWidget.onFirstRedraw(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
int w = cm.getGutterElement().getOffsetWidth();
|
||||
getElement().getStyle().setPaddingLeft(w, Unit.PX);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -110,14 +107,7 @@ class SkipBar extends Composite {
|
||||
.set("inclusiveLeft", true)
|
||||
.set("inclusiveRight", true));
|
||||
|
||||
textMarker.on(
|
||||
"beforeCursorEnter",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
expandAll();
|
||||
}
|
||||
});
|
||||
textMarker.on("beforeCursorEnter", this::expandAll);
|
||||
|
||||
int skipped = end - start + 1;
|
||||
if (skipped <= UP_DOWN_THRESHOLD) {
|
||||
|
@@ -30,7 +30,6 @@ import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.JavaScriptObject;
|
||||
import com.google.gwt.core.client.JsArrayString;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.event.dom.client.FocusEvent;
|
||||
import com.google.gwt.event.dom.client.FocusHandler;
|
||||
@@ -102,12 +101,9 @@ public class Unified extends DiffScreen {
|
||||
super.onShowView();
|
||||
|
||||
operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
resizeCodeMirror();
|
||||
cm.refresh();
|
||||
}
|
||||
});
|
||||
setLineLength(Patch.COMMIT_MSG.equals(path) ? 72 : prefs.lineLength());
|
||||
diffTable.refresh();
|
||||
@@ -142,14 +138,11 @@ public class Unified extends DiffScreen {
|
||||
|
||||
cm.on(
|
||||
"scroll",
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
ScrollInfo si = cm.getScrollInfo();
|
||||
if (autoHideDiffTableHeader) {
|
||||
updateDiffTableHeader(si);
|
||||
}
|
||||
}
|
||||
});
|
||||
maybeRegisterRenderEntireFileKeyMap(cm);
|
||||
}
|
||||
@@ -186,9 +179,7 @@ public class Unified extends DiffScreen {
|
||||
chunkManager = new UnifiedChunkManager(this, cm, diffTable.scrollbar);
|
||||
|
||||
operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
// Estimate initial CodeMirror height, fixed up in onShowView.
|
||||
int height = Window.getClientHeight() - (Gerrit.getHeaderFooterHeight() + 18);
|
||||
cm.setHeight(height);
|
||||
@@ -196,7 +187,6 @@ public class Unified extends DiffScreen {
|
||||
render(diff);
|
||||
commentManager.render(comments, prefs.expandAllComments());
|
||||
skipManager.render(prefs.context(), diff);
|
||||
}
|
||||
});
|
||||
|
||||
registerCmEvents(cm);
|
||||
@@ -318,9 +308,7 @@ public class Unified extends DiffScreen {
|
||||
|
||||
@Override
|
||||
Runnable updateActiveLine(final CodeMirror cm) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
return () -> {
|
||||
// The rendering of active lines has to be deferred. Reflow
|
||||
// caused by adding and removing styles chokes Firefox when arrow
|
||||
// key (or j/k) is held down. Performance on Chrome is fine
|
||||
@@ -328,14 +316,10 @@ public class Unified extends DiffScreen {
|
||||
//
|
||||
Scheduler.get()
|
||||
.scheduleDeferred(
|
||||
new ScheduledCommand() {
|
||||
@Override
|
||||
public void execute() {
|
||||
() -> {
|
||||
LineHandle handle = cm.getLineHandleVisualStart(cm.getCursor("end").line());
|
||||
cm.extras().activeLine(handle);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -354,14 +338,8 @@ public class Unified extends DiffScreen {
|
||||
}
|
||||
|
||||
@Override
|
||||
void operation(final Runnable apply) {
|
||||
cm.operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
apply.run();
|
||||
}
|
||||
});
|
||||
void operation(Runnable apply) {
|
||||
cm.operation(apply::run);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -214,9 +214,7 @@ class UnifiedChunkManager extends ChunkManager {
|
||||
|
||||
@Override
|
||||
Runnable diffChunkNav(final CodeMirror cm, final Direction dir) {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
return () -> {
|
||||
int line = cm.extras().hasActiveLine() ? cm.getLineNumber(cm.extras().activeLine()) : 0;
|
||||
int res =
|
||||
Collections.binarySearch(
|
||||
@@ -224,7 +222,6 @@ class UnifiedChunkManager extends ChunkManager {
|
||||
new UnifiedDiffChunkInfo(cm.side(), 0, 0, line, false),
|
||||
getDiffChunkComparatorCmLine());
|
||||
diffChunkNavHelper(chunks, host, res, dir);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -50,9 +50,7 @@ class UnifiedCommentGroup extends CommentGroup {
|
||||
void handleRedraw() {
|
||||
getLineWidget()
|
||||
.onRedraw(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
if (canComputeHeight()) {
|
||||
if (getResizeTimer() != null) {
|
||||
getResizeTimer().cancel();
|
||||
@@ -73,7 +71,6 @@ class UnifiedCommentGroup extends CommentGroup {
|
||||
});
|
||||
getResizeTimer().scheduleRepeating(5);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -49,7 +49,6 @@ import com.google.gerrit.reviewdb.client.PatchSet;
|
||||
import com.google.gwt.core.client.GWT;
|
||||
import com.google.gwt.core.client.JsArray;
|
||||
import com.google.gwt.core.client.Scheduler;
|
||||
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
|
||||
import com.google.gwt.dom.client.Element;
|
||||
import com.google.gwt.dom.client.Style.Unit;
|
||||
import com.google.gwt.event.dom.client.ClickEvent;
|
||||
@@ -318,11 +317,8 @@ public class EditScreen extends Screen {
|
||||
}
|
||||
|
||||
private Runnable gotoLine() {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
return () -> {
|
||||
cmEdit.execCommand("jumpToLine");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -474,18 +470,12 @@ public class EditScreen extends Screen {
|
||||
|
||||
void setTheme(final Theme newTheme) {
|
||||
cmBase.operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
cmBase.setOption("theme", newTheme.name().toLowerCase());
|
||||
}
|
||||
});
|
||||
cmEdit.operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
cmEdit.setOption("theme", newTheme.name().toLowerCase());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -506,18 +496,12 @@ public class EditScreen extends Screen {
|
||||
|
||||
void setShowWhitespaceErrors(final boolean show) {
|
||||
cmBase.operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
cmBase.setOption("showTrailingSpace", show);
|
||||
}
|
||||
});
|
||||
cmEdit.operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
cmEdit.setOption("showTrailingSpace", show);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -643,9 +627,7 @@ public class EditScreen extends Screen {
|
||||
}
|
||||
|
||||
private Runnable updateCursorPosition() {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
return () -> {
|
||||
// The rendering of active lines has to be deferred. Reflow
|
||||
// caused by adding and removing styles chokes Firefox when arrow
|
||||
// key (or j/k) is held down. Performance on Chrome is fine
|
||||
@@ -653,19 +635,9 @@ public class EditScreen extends Screen {
|
||||
//
|
||||
Scheduler.get()
|
||||
.scheduleDeferred(
|
||||
new ScheduledCommand() {
|
||||
@Override
|
||||
public void execute() {
|
||||
cmEdit.operation(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
updateActiveLine();
|
||||
}
|
||||
() -> {
|
||||
cmEdit.operation(this::updateActiveLine);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -683,9 +655,7 @@ public class EditScreen extends Screen {
|
||||
}
|
||||
|
||||
private Runnable save() {
|
||||
return new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
return () -> {
|
||||
if (!cmEdit.isClean(generation)) {
|
||||
close.setEnabled(false);
|
||||
String text = cmEdit.getValue();
|
||||
@@ -714,7 +684,6 @@ public class EditScreen extends Screen {
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -121,9 +121,7 @@ public abstract class AbstractLuceneIndex<K, V> implements Index<K, V> {
|
||||
@SuppressWarnings("unused") // Error handling within Runnable.
|
||||
Future<?> possiblyIgnoredError =
|
||||
autoCommitExecutor.scheduleAtFixedRate(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
try {
|
||||
if (autoCommitWriter.hasUncommittedChanges()) {
|
||||
autoCommitWriter.manualFlush();
|
||||
@@ -144,7 +142,6 @@ public abstract class AbstractLuceneIndex<K, V> implements Index<K, V> {
|
||||
e);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
commitPeriod,
|
||||
commitPeriod,
|
||||
|
@@ -228,12 +228,9 @@ public class Daemon extends SiteProgram {
|
||||
try {
|
||||
start();
|
||||
RuntimeShutdown.add(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
log.info("caught shutdown, cleaning up");
|
||||
stop();
|
||||
}
|
||||
});
|
||||
|
||||
log.info("Gerrit Code Review " + myVersion() + " ready");
|
||||
|
@@ -45,16 +45,13 @@ public class Gsql extends SiteProgram {
|
||||
manager.add(dbInjector);
|
||||
manager.start();
|
||||
RuntimeShutdown.add(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
try {
|
||||
System.in.close();
|
||||
} catch (IOException e) {
|
||||
// Ignored
|
||||
}
|
||||
manager.stop();
|
||||
}
|
||||
});
|
||||
final QueryShell shell = shellFactory().create(System.in, System.out);
|
||||
shell.setOutputFormat(format);
|
||||
|
@@ -85,13 +85,7 @@ public class ProtobufImport extends SiteProgram {
|
||||
Injector dbInjector = createDbInjector(SINGLE_USER);
|
||||
manager.add(dbInjector);
|
||||
manager.start();
|
||||
RuntimeShutdown.add(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
manager.stop();
|
||||
}
|
||||
});
|
||||
RuntimeShutdown.add(manager::stop);
|
||||
dbInjector.injectMembers(this);
|
||||
|
||||
ProgressMonitor progress = new TextProgressMonitor();
|
||||
|
@@ -79,19 +79,16 @@ public abstract class MetricMaker {
|
||||
* @param value only value of the metric.
|
||||
* @param desc description of the metric.
|
||||
*/
|
||||
public <V> void newConstantMetric(String name, final V value, Description desc) {
|
||||
public <V> void newConstantMetric(String name, V value, Description desc) {
|
||||
desc.setConstant();
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
Class<V> type = (Class<V>) value.getClass();
|
||||
final CallbackMetric0<V> metric = newCallbackMetric(name, type, desc);
|
||||
CallbackMetric0<V> metric = newCallbackMetric(name, type, desc);
|
||||
newTrigger(
|
||||
metric,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
metric.set(value);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -116,15 +113,12 @@ public abstract class MetricMaker {
|
||||
* @param trigger function to compute the value of the metric.
|
||||
*/
|
||||
public <V> void newCallbackMetric(
|
||||
String name, Class<V> valueClass, Description desc, final Supplier<V> trigger) {
|
||||
final CallbackMetric0<V> metric = newCallbackMetric(name, valueClass, desc);
|
||||
String name, Class<V> valueClass, Description desc, Supplier<V> trigger) {
|
||||
CallbackMetric0<V> metric = newCallbackMetric(name, valueClass, desc);
|
||||
newTrigger(
|
||||
metric,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
metric.set(trigger.get());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -147,9 +147,7 @@ public class ProcMetricModule extends MetricModule {
|
||||
metrics.newTrigger(
|
||||
ImmutableSet.<CallbackMetric<?>>of(
|
||||
heapCommitted, heapUsed, nonHeapCommitted, nonHeapUsed, objectPendingFinalizationCount),
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
try {
|
||||
MemoryUsage stats = memory.getHeapMemoryUsage();
|
||||
heapCommitted.set(stats.getCommitted());
|
||||
@@ -163,7 +161,6 @@ public class ProcMetricModule extends MetricModule {
|
||||
nonHeapUsed.set(stats.getUsed());
|
||||
|
||||
objectPendingFinalizationCount.set(memory.getObjectPendingFinalizationCount());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -187,9 +184,7 @@ public class ProcMetricModule extends MetricModule {
|
||||
metrics.newTrigger(
|
||||
gcCount,
|
||||
gcTime,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
for (GarbageCollectorMXBean gc : ManagementFactory.getGarbageCollectorMXBeans()) {
|
||||
long count = gc.getCollectionCount();
|
||||
if (count != -1) {
|
||||
@@ -200,7 +195,6 @@ public class ProcMetricModule extends MetricModule {
|
||||
gcTime.set(gc.getName(), time);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -119,19 +119,13 @@ public final class StoredValues {
|
||||
GitRepositoryManager gitMgr = env.getArgs().getGitRepositoryManager();
|
||||
Change change = getChange(engine);
|
||||
Project.NameKey projectKey = change.getProject();
|
||||
final Repository repo;
|
||||
Repository repo;
|
||||
try {
|
||||
repo = gitMgr.openRepository(projectKey);
|
||||
} catch (IOException e) {
|
||||
throw new SystemException(e.getMessage());
|
||||
}
|
||||
env.addToCleanup(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
repo.close();
|
||||
}
|
||||
});
|
||||
env.addToCleanup(repo::close);
|
||||
return repo;
|
||||
}
|
||||
};
|
||||
|
@@ -69,9 +69,7 @@ public class CacheMetrics {
|
||||
|
||||
metrics.newTrigger(
|
||||
cacheMetrics,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
for (DynamicMap.Entry<Cache<?, ?>> e : cacheMap) {
|
||||
Cache<?, ?> c = e.getProvider().get();
|
||||
String name = metricNameOf(e);
|
||||
@@ -88,7 +86,6 @@ public class CacheMetrics {
|
||||
for (CallbackMetric<?> cbm : cacheMetrics) {
|
||||
cbm.prune();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -51,12 +51,9 @@ public class RequestScopedReviewDbProvider implements Provider<ReviewDb> {
|
||||
cleanup
|
||||
.get()
|
||||
.add(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
c.close();
|
||||
db = null;
|
||||
}
|
||||
});
|
||||
} catch (Throwable e) {
|
||||
c.close();
|
||||
|
@@ -54,16 +54,11 @@ public class ProjectCacheWarmer implements LifecycleListener {
|
||||
|
||||
log.info("Loading project cache");
|
||||
scheduler.execute(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
for (final Project.NameKey name : cache.all()) {
|
||||
pool.execute(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
cache.get(name);
|
||||
}
|
||||
});
|
||||
}
|
||||
pool.shutdown();
|
||||
@@ -73,7 +68,6 @@ public class ProjectCacheWarmer implements LifecycleListener {
|
||||
} catch (InterruptedException e) {
|
||||
log.warn("Interrupted while waiting for project cache to load");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@@ -161,8 +161,8 @@ public class DataSourceProvider implements Provider<DataSource>, LifecycleListen
|
||||
}
|
||||
}
|
||||
|
||||
private void exportPoolMetrics(final BasicDataSource pool) {
|
||||
final CallbackMetric1<Boolean, Integer> cnt =
|
||||
private void exportPoolMetrics(BasicDataSource pool) {
|
||||
CallbackMetric1<Boolean, Integer> cnt =
|
||||
metrics.newCallbackMetric(
|
||||
"sql/connection_pool/connections",
|
||||
Integer.class,
|
||||
@@ -170,14 +170,11 @@ public class DataSourceProvider implements Provider<DataSource>, LifecycleListen
|
||||
Field.ofBoolean("active"));
|
||||
metrics.newTrigger(
|
||||
cnt,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
synchronized (pool) {
|
||||
cnt.set(true, pool.getNumActive());
|
||||
cnt.set(false, pool.getNumIdle());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -133,12 +133,9 @@ public class ProcMetricModuleTest {
|
||||
final AtomicInteger invocations = new AtomicInteger(0);
|
||||
metrics.newTrigger(
|
||||
cntr,
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
invocations.getAndIncrement();
|
||||
cntr.set(42L);
|
||||
}
|
||||
});
|
||||
|
||||
// Triggers run immediately with DropWizard binding.
|
||||
|
@@ -159,15 +159,12 @@ public class RepoSequenceTest {
|
||||
// Seed existing ref value.
|
||||
writeBlob("id", "1");
|
||||
|
||||
final AtomicBoolean doneBgUpdate = new AtomicBoolean(false);
|
||||
AtomicBoolean doneBgUpdate = new AtomicBoolean(false);
|
||||
Runnable bgUpdate =
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
if (!doneBgUpdate.getAndSet(true)) {
|
||||
writeBlob("id", "1234");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
RepoSequence s = newSequence("id", 1, 10, bgUpdate, RETRYER);
|
||||
@@ -203,13 +200,10 @@ public class RepoSequenceTest {
|
||||
|
||||
@Test
|
||||
public void failAfterRetryerGivesUp() throws Exception {
|
||||
final AtomicInteger bgCounter = new AtomicInteger(1234);
|
||||
AtomicInteger bgCounter = new AtomicInteger(1234);
|
||||
Runnable bgUpdate =
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
() -> {
|
||||
writeBlob("id", Integer.toString(bgCounter.getAndAdd(1000)));
|
||||
}
|
||||
};
|
||||
RepoSequence s =
|
||||
newSequence(
|
||||
|
@@ -230,13 +230,7 @@ class CommandFactoryProvider implements Provider<CommandFactory>, LifecycleListe
|
||||
Future<?> future = task.getAndSet(null);
|
||||
if (future != null) {
|
||||
future.cancel(true);
|
||||
destroyExecutor.execute(
|
||||
new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
onDestroy();
|
||||
}
|
||||
});
|
||||
destroyExecutor.execute(this::onDestroy);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user