mirror of
https://github.com/xpipe-io/xpipe.git
synced 2025-04-19 02:33:39 +00:00
Improve exit blocking
This commit is contained in:
parent
28787abc5a
commit
5b9649d0b6
3 changed files with 24 additions and 4 deletions
|
@ -55,7 +55,8 @@ public class BrowserSessionModel extends BrowserAbstractSessionModel<BrowserSess
|
|||
continue;
|
||||
}
|
||||
|
||||
closeSync(o);
|
||||
// Prevent blocking of shutdown
|
||||
closeAsync(o);
|
||||
}
|
||||
BrowserSavedStateImpl.get().save();
|
||||
}
|
||||
|
|
|
@ -130,10 +130,17 @@ public abstract class DataStorage {
|
|||
}
|
||||
|
||||
private void dispose() {
|
||||
getStoreEntries().forEach(entry -> {
|
||||
entry.finalizeEntry();
|
||||
});
|
||||
save(true);
|
||||
var finalizing = false;
|
||||
for (DataStoreEntry entry : getStoreEntries()) {
|
||||
// Prevent blocking of shutdown
|
||||
if (entry.finalizeEntryAsync()) {
|
||||
finalizing = true;
|
||||
}
|
||||
}
|
||||
if (finalizing) {
|
||||
ThreadHelper.sleep(1000);
|
||||
}
|
||||
}
|
||||
|
||||
protected void setupBuiltinCategories() {
|
||||
|
|
|
@ -4,6 +4,7 @@ import io.xpipe.app.ext.DataStoreProvider;
|
|||
import io.xpipe.app.ext.DataStoreProviders;
|
||||
import io.xpipe.app.issue.ErrorEvent;
|
||||
import io.xpipe.app.resources.SystemIcons;
|
||||
import io.xpipe.app.util.ThreadHelper;
|
||||
import io.xpipe.core.store.*;
|
||||
import io.xpipe.core.util.JacksonMapper;
|
||||
|
||||
|
@ -627,6 +628,17 @@ public class DataStoreEntry extends StorageElement {
|
|||
}
|
||||
}
|
||||
|
||||
public boolean finalizeEntryAsync() {
|
||||
if (store instanceof ExpandedLifecycleStore) {
|
||||
ThreadHelper.runAsync(() -> {
|
||||
finalizeEntry();
|
||||
});
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean shouldSave() {
|
||||
return getStore() != null;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue