WebDavMounter warmUp in background thread.

This commit is contained in:
Sebastian Stenzel
2015-02-22 13:52:28 +01:00
parent 30dc8eecb1
commit 028f6ea824
2 changed files with 8 additions and 7 deletions

View File

@@ -63,14 +63,12 @@ public final class FXThreads {
* myLabel.setText(bookName);
* });
* </pre>
*
* @param executor
* @param task The task to wait for.
* @param successCallback The action to perform, when the task finished.
*/
public static <T> void runOnMainThreadWhenFinished(ExecutorService executor, Future<T> task, CallbackWhenTaskFinished<T> successCallback) {
executor.submit(() -> {
return "asd";
});
runOnMainThreadWhenFinished(executor, task, successCallback, DUMMY_EXCEPTION_CALLBACK);
}
@@ -89,8 +87,7 @@ public final class FXThreads {
* });
* </pre>
*
* @param executor
* The service to execute the background task on
* @param executor The service to execute the background task on
* @param task The task to wait for.
* @param successCallback The action to perform, when the task finished.
* @param exceptionCallback

View File

@@ -9,6 +9,8 @@
******************************************************************************/
package org.cryptomator.ui.util.mount;
import java.util.concurrent.ExecutorService;
import javax.inject.Inject;
import org.cryptomator.webdav.WebDavServer;
@@ -24,9 +26,11 @@ public class WebDavMounterProvider implements Provider<WebDavMounter> {
private final WebDavMounterStrategy choosenStrategy;
@Inject
public WebDavMounterProvider(WebDavServer server) {
public WebDavMounterProvider(WebDavServer server, ExecutorService executorService) {
this.choosenStrategy = getStrategyWhichShouldWork();
this.choosenStrategy.warmUp(server.getPort());
executorService.execute(() -> {
this.choosenStrategy.warmUp(server.getPort());
});
}
@Override