summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageCreationWizard.java
diff options
context:
space:
mode:
authorSimon Rettberg2022-03-21 17:22:16 +0100
committerSimon Rettberg2022-03-21 17:22:16 +0100
commitad0788e8fbead90d1ab03ba1a5c83b00114cb3a0 (patch)
treeaf62b617fb6149afce16d417474abd49f373cbf9 /dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageCreationWizard.java
parent[client] Cleanup chunk data lists when upload finished or is cancelled (diff)
downloadtutor-module-ad0788e8fbead90d1ab03ba1a5c83b00114cb3a0.tar.gz
tutor-module-ad0788e8fbead90d1ab03ba1a5c83b00114cb3a0.tar.xz
tutor-module-ad0788e8fbead90d1ab03ba1a5c83b00114cb3a0.zip
[client] Memory management; handle OOM when hashing, do not skip blocks
Try to free some references regarding transfers earlier, e.g. the hash worker and list of hashes as soon as hashing is finished on upload, not only when the upload is finished and the window is closed. Properly delay hashing of blocks in OOM scenarios, and be more conservative with the number of hash workers, i.e. take maximum JVM memory into account. Also, improve thread naming.
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageCreationWizard.java')
-rw-r--r--dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageCreationWizard.java27
1 files changed, 16 insertions, 11 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageCreationWizard.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageCreationWizard.java
index 0bfe2b22..0c56a5c0 100644
--- a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageCreationWizard.java
+++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/wizard/ImageCreationWizard.java
@@ -291,22 +291,24 @@ public class ImageCreationWizard extends Wizard implements UiFeedback, QuitNotif
}
@Override protected boolean onCancelRequest() {
- if (state.uuid == null)
+ if (state == null || state.uuid == null)
return true; // Allow closing - nothing in progress
boolean confirmed = Gui.showMessageBox(this,
I18n.WIZARD.getString("ImageCreation.Message.yesNo.cancelRequest"),
MessageType.QUESTION_YESNO, null, null);
if (confirmed) {
QuickTimer.scheduleOnce(new Task() {
- @Override public void fire() {
- if (state.upload != null) {
+ @Override
+ public void fire() {
+ if (state != null && state.upload != null) {
state.upload.cancelError("Cancelled through aborting wizard");
- }
- // As we're creating a new VM, delete base image aswell
- try {
- ThriftManager.getSatClient().deleteImageBase(Session.getSatelliteToken(), state.uuid);
- } catch (TException e) {
- LOGGER.debug("Error canceling upload on sat: ", e);
+ // As we're creating a new VM, delete base image aswell
+ try {
+ ThriftManager.getSatClient()
+ .deleteImageBase(Session.getSatelliteToken(), state.uuid);
+ } catch (TException e) {
+ LOGGER.debug("Error canceling upload on sat: ", e);
+ }
}
}
});
@@ -315,7 +317,7 @@ public class ImageCreationWizard extends Wizard implements UiFeedback, QuitNotif
}
@Override public boolean wantConfirmQuit() {
- return state.uuid != null;
+ return state != null && state.uuid != null;
}
@Override public void escapePressed() {
@@ -330,7 +332,10 @@ public class ImageCreationWizard extends Wizard implements UiFeedback, QuitNotif
@Override
protected void doCleanup() {
- state = null;
+ if (state != null) {
+ state.upload = null;
+ state = null;
+ }
containerDefinition = null;
currentPages.clear();
}