startup time optimization

This commit is contained in:
Sebastian Stenzel 2021-07-14 17:17:25 +02:00
parent 6eacc6a9d3
commit b47beabc2f
No known key found for this signature in database
GPG Key ID: 667B866EA8240A09
2 changed files with 8 additions and 3 deletions

View File

@ -258,6 +258,10 @@
<version>${dagger.version}</version>
</path>
</annotationProcessorPaths>
<compilerArgs>
<arg>-Adagger.fastInit=enabled</arg>
<arg>-Adagger.formatGeneratedSource=enabled</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>

View File

@ -5,6 +5,7 @@
*******************************************************************************/
package org.cryptomator.launcher;
import dagger.Lazy;
import org.apache.commons.lang3.SystemUtils;
import org.cryptomator.logging.DebugMode;
import org.cryptomator.logging.LoggerConfiguration;
@ -32,10 +33,10 @@ public class Cryptomator {
private final IpcFactory ipcFactory;
private final Optional<String> applicationVersion;
private final CountDownLatch shutdownLatch;
private final UiLauncher uiLauncher;
private final Lazy<UiLauncher> uiLauncher;
@Inject
Cryptomator(LoggerConfiguration logConfig, DebugMode debugMode, IpcFactory ipcFactory, @Named("applicationVersion") Optional<String> applicationVersion, @Named("shutdownLatch") CountDownLatch shutdownLatch, UiLauncher uiLauncher) {
Cryptomator(LoggerConfiguration logConfig, DebugMode debugMode, IpcFactory ipcFactory, @Named("applicationVersion") Optional<String> applicationVersion, @Named("shutdownLatch") CountDownLatch shutdownLatch, Lazy<UiLauncher> uiLauncher) {
this.logConfig = logConfig;
this.debugMode = debugMode;
this.ipcFactory = ipcFactory;
@ -89,7 +90,7 @@ public class Cryptomator {
*/
private int runGuiApplication() {
try {
uiLauncher.launch();
uiLauncher.get().launch();
shutdownLatch.await();
LOG.info("UI shut down");
return 0;