private void update() {
        int tryNumber = 0;
        this.parser.setBasePath(updateDir);
        while (!pendingQueue.isEmpty()) {
            try {
                try {
                    tm.suspended();
                } catch (InterruptedException ex) {
                    Logger.getLogger(UrlHandler.class.getName()).log(Level.SEVERE, null, ex);
                }
                Page page = pendingQueue.removeFirstFromQueue();

                URL _url = new URL(page.getUrl());
                URLConnection con = _url.openConnection(Proxy.NO_PROXY);
                if (parser.getLastModifiedDate(con) > page.getLastModifiedDate()) {
                    page.setLastModifiedDate(parser.getLastModifiedDate(con));
                    if (imageExtensions.contains(parser.getFileExtension(_url))) {
                            parser.downloadImage(_url);
                    } else if (nonHyperTextExtensions.contains(parser.getFileExtension(_url))) {
                            parser.downloadTextFile(_url);
                            this.downloadedQueue.updateLastModified(page);

                    }
                }


            } catch (MalformedURLException ex) {
                Logger.getLogger(UrlHandler.class.getName()).log(Level.SEVERE, null, ex);
            } catch (IOException ex) {
                Logger.getLogger(UrlHandler.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }