diff --git a/src/org/openstreetmap/josm/plugins/PluginHandler.java b/src/org/openstreetmap/josm/plugins/PluginHandler.java
index 390e3fa..887e546 100644
|
a
|
b
|
import java.util.Set;
|
| 34 | 34 | import java.util.TreeSet; |
| 35 | 35 | import java.util.concurrent.Callable; |
| 36 | 36 | import java.util.concurrent.ExecutionException; |
| 37 | | import java.util.concurrent.ExecutorService; |
| 38 | | import java.util.concurrent.Executors; |
| 39 | | import java.util.concurrent.Future; |
| 40 | 37 | import java.util.concurrent.FutureTask; |
| 41 | 38 | import java.util.jar.JarFile; |
| 42 | 39 | |
| … |
… |
public final class PluginHandler {
|
| 812 | 809 | } |
| 813 | 810 | try { |
| 814 | 811 | ReadLocalPluginInformationTask task = new ReadLocalPluginInformationTask(monitor); |
| 815 | | ExecutorService service = Executors.newSingleThreadExecutor(Utils.newThreadFactory("plugin-loader-%d", Thread.NORM_PRIORITY)); |
| 816 | | Future<?> future = service.submit(task); |
| 817 | 812 | try { |
| 818 | | future.get(); |
| 819 | | } catch (ExecutionException e) { |
| | 813 | task.run(); |
| | 814 | } catch (RuntimeException e) { |
| 820 | 815 | Main.error(e); |
| 821 | 816 | return null; |
| 822 | | } catch (InterruptedException e) { |
| 823 | | Main.warn("InterruptedException in "+PluginHandler.class.getSimpleName()+" while loading locally available plugin information"); |
| 824 | | return null; |
| 825 | 817 | } |
| 826 | 818 | Map<String, PluginInformation> ret = new HashMap<>(); |
| 827 | 819 | for (PluginInformation pi: task.getAvailablePlugins()) { |
| … |
… |
public final class PluginHandler {
|
| 969 | 961 | } |
| 970 | 962 | try { |
| 971 | 963 | monitor.beginTask(""); |
| 972 | | ExecutorService service = Executors.newSingleThreadExecutor(Utils.newThreadFactory("plugin-updater-%d", Thread.NORM_PRIORITY)); |
| 973 | 964 | |
| 974 | 965 | // try to download the plugin lists |
| 975 | 966 | // |
| … |
… |
public final class PluginHandler {
|
| 977 | 968 | monitor.createSubTaskMonitor(1, false), |
| 978 | 969 | Main.pref.getOnlinePluginSites(), displayErrMsg |
| 979 | 970 | ); |
| 980 | | Future<?> future = service.submit(task1); |
| | 971 | task1.run(); |
| 981 | 972 | List<PluginInformation> allPlugins = null; |
| 982 | 973 | |
| 983 | 974 | try { |
| 984 | | future.get(); |
| 985 | 975 | allPlugins = task1.getAvailablePlugins(); |
| 986 | 976 | plugins = buildListOfPluginsToLoad(parent, monitor.createSubTaskMonitor(1, false)); |
| 987 | 977 | // If only some plugins have to be updated, filter the list |
| … |
… |
public final class PluginHandler {
|
| 1000 | 990 | } |
| 1001 | 991 | } |
| 1002 | 992 | } |
| 1003 | | } catch (ExecutionException e) { |
| | 993 | } catch (RuntimeException e) { |
| 1004 | 994 | Main.warn(tr("Failed to download plugin information list")+": ExecutionException"); |
| 1005 | 995 | Main.error(e); |
| 1006 | 996 | // don't abort in case of error, continue with downloading plugins below |
| 1007 | | } catch (InterruptedException e) { |
| 1008 | | Main.warn(tr("Failed to download plugin information list")+": InterruptedException"); |
| 1009 | | // don't abort in case of error, continue with downloading plugins below |
| 1010 | 997 | } |
| 1011 | 998 | |
| 1012 | 999 | // filter plugins which actually have to be updated |
| … |
… |
public final class PluginHandler {
|
| 1045 | 1032 | tr("Update plugins") |
| 1046 | 1033 | ); |
| 1047 | 1034 | |
| 1048 | | future = service.submit(pluginDownloadTask); |
| 1049 | 1035 | try { |
| 1050 | | future.get(); |
| 1051 | | } catch (ExecutionException e) { |
| | 1036 | pluginDownloadTask.run(); |
| | 1037 | } catch (RuntimeException e) { |
| 1052 | 1038 | Main.error(e); |
| 1053 | 1039 | alertFailedPluginUpdate(parent, pluginsToUpdate); |
| 1054 | 1040 | return plugins; |
| 1055 | | } catch (InterruptedException e) { |
| 1056 | | Main.warn("InterruptedException in "+PluginHandler.class.getSimpleName()+" while updating plugins"); |
| 1057 | | alertFailedPluginUpdate(parent, pluginsToUpdate); |
| 1058 | | return plugins; |
| 1059 | 1041 | } |
| 1060 | 1042 | |
| 1061 | 1043 | // Update Plugin info for downloaded plugins |