Changeset 8776 in josm for trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
- Timestamp:
- 2015-09-21T21:50:16+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/plugins/PluginHandler.java
r8773 r8776 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; … … 815 812 try { 816 813 ReadLocalPluginInformationTask task = new ReadLocalPluginInformationTask(monitor); 817 ExecutorService service = Executors.newSingleThreadExecutor(Utils.newThreadFactory("plugin-loader-%d", Thread.NORM_PRIORITY));818 Future<?> future = service.submit(task);819 814 try { 820 future.get();821 } catch ( ExecutionException e) {815 task.run(); 816 } catch (RuntimeException e) { 822 817 Main.error(e); 823 return null;824 } catch (InterruptedException e) {825 Main.warn("InterruptedException in "+PluginHandler.class.getSimpleName()+" while loading locally available plugin information");826 818 return null; 827 819 } … … 972 964 try { 973 965 monitor.beginTask(""); 974 ExecutorService service = Executors.newSingleThreadExecutor(Utils.newThreadFactory("plugin-updater-%d", Thread.NORM_PRIORITY));975 966 976 967 // try to download the plugin lists … … 980 971 Main.pref.getOnlinePluginSites(), displayErrMsg 981 972 ); 982 Future<?> future = service.submit(task1);973 task1.run(); 983 974 List<PluginInformation> allPlugins = null; 984 975 985 976 try { 986 future.get();987 977 allPlugins = task1.getAvailablePlugins(); 988 978 plugins = buildListOfPluginsToLoad(parent, monitor.createSubTaskMonitor(1, false)); … … 1003 993 } 1004 994 } 1005 } catch ( ExecutionException e) {1006 Main.warn(tr("Failed to download plugin information list") +": ExecutionException");995 } catch (RuntimeException e) { 996 Main.warn(tr("Failed to download plugin information list")); 1007 997 Main.error(e); 1008 // don't abort in case of error, continue with downloading plugins below1009 } catch (InterruptedException e) {1010 Main.warn(tr("Failed to download plugin information list")+": InterruptedException");1011 998 // don't abort in case of error, continue with downloading plugins below 1012 999 } … … 1048 1035 ); 1049 1036 1050 future = service.submit(pluginDownloadTask);1051 1037 try { 1052 future.get();1053 } catch ( ExecutionException e) {1038 pluginDownloadTask.run(); 1039 } catch (RuntimeException e) { 1054 1040 Main.error(e); 1055 alertFailedPluginUpdate(parent, pluginsToUpdate);1056 return plugins;1057 } catch (InterruptedException e) {1058 Main.warn("InterruptedException in "+PluginHandler.class.getSimpleName()+" while updating plugins");1059 1041 alertFailedPluginUpdate(parent, pluginsToUpdate); 1060 1042 return plugins;
Note:
See TracChangeset
for help on using the changeset viewer.