Changeset 8412 in josm for trunk/src


Ignore:
Timestamp:
2015-05-22T01:06:28+02:00 (10 years ago)
Author:
Don-vip
Message:

ExecutorService field doesn't ever get shutdown

Location:
trunk/src/org/openstreetmap/josm
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/Main.java

    r8404 r8412  
    10811081
    10821082    /**
    1083      * Closes JOSM and optionally terminates the Java Virtual Machine (JVM). If there are some unsaved data layers, asks first for user confirmation.
     1083     * Closes JOSM and optionally terminates the Java Virtual Machine (JVM).
     1084     * If there are some unsaved data layers, asks first for user confirmation.
    10841085     * @param exit If {@code true}, the JVM is terminated by running {@link System#exit} with a given return code.
    10851086     * @param exitCode The return code
     
    10881089     */
    10891090    public static boolean exitJosm(boolean exit, int exitCode) {
    1090         JCSCacheManager.shutdown();
    10911091        if (Main.saveUnsavedModifications()) {
     1092            worker.shutdown();
     1093            ImageProvider.shutdown(false);
     1094            JCSCacheManager.shutdown();
    10921095            geometry.remember("gui.geometry");
    10931096            if (map != null) {
     
    11021105                }
    11031106            }
     1107            worker.shutdownNow();
     1108            ImageProvider.shutdown(true);
     1109
    11041110            if (exit) {
    11051111                System.exit(exitCode);
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java

    r8308 r8412  
    434434    protected class SaveAndUploadTask implements Runnable {
    435435
    436         private SaveLayersModel model;
    437         private ProgressMonitor monitor;
    438         private ExecutorService worker;
     436        private final SaveLayersModel model;
     437        private final ProgressMonitor monitor;
     438        private final ExecutorService worker;
    439439        private boolean canceled;
    440440        private Future<?> currentFuture;
     
    592592                }
    593593            });
     594            worker.shutdownNow();
    594595        }
    595596
     
    598599                currentTask.cancel();
    599600            }
     601            worker.shutdown();
    600602            canceled = true;
    601603        }
  • trunk/src/org/openstreetmap/josm/tools/ImageProvider.java

    r8404 r8412  
    16121612     * @return The same image as {@code bi} where all pixels of the given color are transparent.
    16131613     * This resulting image has also the special property {@link #PROP_TRANSPARENCY_FORCED} set to {@code color}
    1614      * @since 7132
    16151614     * @see BufferedImage#getProperty
    16161615     * @see #isTransparencyForced
     1616     * @since 7132
    16171617     */
    16181618    public static BufferedImage makeImageTransparent(BufferedImage bi, Color color) {
     
    16531653     * @param bi The {@code BufferedImage} to test
    16541654     * @return {@code true} if the transparency of {@code bi} has been enforced by a previous call to {@code makeImageTransparent}.
     1655     * @see #makeImageTransparent
    16551656     * @since 7132
    1656      * @see #makeImageTransparent
    16571657     */
    16581658    public static boolean isTransparencyForced(BufferedImage bi) {
     
    16641664     * @param bi The {@code BufferedImage} to test
    16651665     * @return {@code true} if {@code bi} has a transparent color determined by a previous call to {@code read}.
     1666     * @see #read
    16661667     * @since 7132
    1667      * @see #read
    16681668     */
    16691669    public static boolean hasTransparentColor(BufferedImage bi) {
    16701670        return bi != null && !bi.getProperty(PROP_TRANSPARENCY_COLOR).equals(Image.UndefinedProperty);
    16711671    }
     1672
     1673    /**
     1674     * Shutdown background image fetcher.
     1675     * @param now if {@code true}, attempts to stop all actively executing tasks, halts the processing of waiting tasks.
     1676     * if {@code false}, initiates an orderly shutdown in which previously submitted tasks are executed, but no new tasks will be accepted
     1677     * @since 8412
     1678     */
     1679    public static void shutdown(boolean now) {
     1680        if (now) {
     1681            IMAGE_FETCHER.shutdownNow();
     1682        } else {
     1683            IMAGE_FETCHER.shutdown();
     1684        }
     1685    }
    16721686}
Note: See TracChangeset for help on using the changeset viewer.