Ticket #2096: Shutdown WMS Loader Threads.patch

File Shutdown WMS Loader Threads.patch, 857 bytes (added by xeen, 16 years ago)

At least for me this now frees memory when removing a layer, maybe it helps

  • src/wmsplugin/WMSLayer.java

     
    6262    protected String baseURL;
    6363    protected final int serializeFormatVersion = 4;
    6464
    65     private ExecutorService executor;
     65    private ExecutorService executor = null;
    6666
    6767    public WMSLayer() {
    6868        this(tr("Blank Layer"), null);
     
    8282       
    8383        executor = Executors.newFixedThreadPool(3);
    8484    }
     85   
     86    public void destroy() {
     87        try {
     88            executor.shutdown(); 
     89        // Might not be initalized, so catch NullPointer as well
     90        } catch(Exception x) {}
     91    }
    8592
    8693    public void getPPD(){
    8794        pixelPerDegree = mv.getWidth() / (bounds().max.lon() - bounds().min.lon());