Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#5062 JVM Crash in bndtools explorer #5411

Merged
merged 1 commit into from Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion bndtools.core/src/bndtools/Plugin.java
Expand Up @@ -70,7 +70,7 @@ public void start(BundleContext context) throws Exception {
plugin = this;
this.bundleContext = context;

scheduler = Executors.newScheduledThreadPool(1);
scheduler = Executors.newScheduledThreadPool(4);

bndActivator = new Activator();
bndActivator.start(context);
Expand Down
4 changes: 3 additions & 1 deletion bndtools.core/src/bndtools/explorer/BndtoolsExplorer.java
Expand Up @@ -336,9 +336,11 @@ private void updateTreeViewer() {
if (!installed) {
installed = true;
installFilter();
model.filterDirty.set(true);
}

getTreeViewer().refresh();
if (model.filterDirty.getAndSet(false))
getTreeViewer().refresh();
}

private void installFilter() {
Expand Down
16 changes: 5 additions & 11 deletions bndtools.core/src/bndtools/explorer/Model.java
Expand Up @@ -24,6 +24,7 @@ class Model {
String message = "initializing workspace";
int severity;
String filterText;
final AtomicBoolean filterDirty = new AtomicBoolean(false);
final List<Runnable> updates = new ArrayList<>();
final AtomicBoolean dirty = new AtomicBoolean(false);
final Set<IProject> pinned = new HashSet<>();
Expand All @@ -48,6 +49,7 @@ void setFilterText(String value) {
glob = null;
else
glob = new Glob(value);
filterDirty.set(true);
update();
}

Expand Down Expand Up @@ -77,14 +79,15 @@ void updateMessage() {
void setSeverity(int severity) {
if (this.severity != severity) {
this.severity = severity;
filterDirty.set(true);
update();
}
}

private String getPrompt(Workspace ws) {
try {
if (prompt == null || prompt.isEmpty())
prompt = "<b>${basename;${workspace}}</b> ${def;Bundle-Version} <a href='prefs'>change macro def</a>";
prompt = "<b>${basename;${workspace}}</b> ${def;Bundle-Version} <a href='prefs'>[?]</a>";
else if ("-".equals(prompt))
return "";

Expand Down Expand Up @@ -113,16 +116,6 @@ void update() {
* This runs async on the display thread.
*/
private void update0() {
try {
// coalesce some more updates on
// the worker thread(s).
Thread.sleep(50);
} catch (InterruptedException e) {
Thread.currentThread()
.interrupt();
return;
}

if (dirty.getAndSet(false)) {
updates.forEach(Runnable::run);
}
Expand All @@ -138,6 +131,7 @@ void doPin() {
} else {
pinned.add(p);
}
filterDirty.set(true);
update();
}

Expand Down