another threading bugfix
This commit is contained in:
parent
7ae0fcedb7
commit
ea73f80a06
|
@ -34,7 +34,7 @@ import static com.rusefi.core.FindFileHelper.findSrecFile;
|
||||||
|
|
||||||
public class Autoupdate {
|
public class Autoupdate {
|
||||||
private static final Logging log = getLogging(Autoupdate.class);
|
private static final Logging log = getLogging(Autoupdate.class);
|
||||||
private static final int AUTOUPDATE_VERSION = 20240918; // separate from rusEFIVersion#CONSOLE_VERSION
|
private static final int AUTOUPDATE_VERSION = 20241004; // separate from rusEFIVersion#CONSOLE_VERSION
|
||||||
|
|
||||||
private static final String LOGO_PATH = "/com/rusefi/";
|
private static final String LOGO_PATH = "/com/rusefi/";
|
||||||
private static final String LOGO = LOGO_PATH + "logo.png";
|
private static final String LOGO = LOGO_PATH + "logo.png";
|
||||||
|
|
|
@ -8,10 +8,12 @@ import org.jetbrains.annotations.Nullable;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLClassLoader;
|
import java.net.URLClassLoader;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public class AutoupdateUtil {
|
public class AutoupdateUtil {
|
||||||
public static final boolean runHeadless = Boolean.getBoolean("run_headless") || GraphicsEnvironment.isHeadless();
|
public static final boolean runHeadless = Boolean.getBoolean("run_headless") || GraphicsEnvironment.isHeadless();
|
||||||
|
@ -26,7 +28,7 @@ public class AutoupdateUtil {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ProgressView createProgressView(String title) {
|
private static ProgressView doCreateProgressView(String title) {
|
||||||
if (runHeadless) {
|
if (runHeadless) {
|
||||||
return new ProgressView(null, null);
|
return new ProgressView(null, null);
|
||||||
} else {
|
} else {
|
||||||
|
@ -64,6 +66,18 @@ public class AutoupdateUtil {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static ProgressView createProgressView(String title) {
|
||||||
|
AtomicReference<ProgressView> result = new AtomicReference<>();
|
||||||
|
try {
|
||||||
|
SwingUtilities.invokeAndWait(() -> result.set(doCreateProgressView(title)));
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (InvocationTargetException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
return result.get();
|
||||||
|
}
|
||||||
|
|
||||||
private static class DynamicForResourcesURLClassLoader extends URLClassLoader {
|
private static class DynamicForResourcesURLClassLoader extends URLClassLoader {
|
||||||
public DynamicForResourcesURLClassLoader(ClassLoader parent ) {
|
public DynamicForResourcesURLClassLoader(ClassLoader parent ) {
|
||||||
super(new URL[ 0 ], parent );
|
super(new URL[ 0 ], parent );
|
||||||
|
|
Loading…
Reference in New Issue