Examples of FProxyFetchInProgress


Examples of freenet.clients.http.FProxyFetchInProgress

  @Override
  public void dispose() {
    if (logMINOR) {
      Logger.minor(this, "Disposing ImageElement");
    }
    FProxyFetchInProgress progress = tracker.getFetchInProgress(key, maxSize, null);
    if (progress != null) {
      progress.removeListener(fetchListener);
      if (logMINOR) {
        Logger.minor(this, "canCancel():" + progress.canCancel());
      }
      progress.requestImmediateCancel();
      if (progress.canCancel()) {
        tracker.run();
      }
    }
  }
View Full Code Here

Examples of freenet.clients.http.FProxyFetchInProgress

    return Base64.encodeStandardUTF8(("progressinfo[URI:" + uri.toString() + "]"));
  }

  @Override
  public void dispose() {
    FProxyFetchInProgress progress = tracker.getFetchInProgress(key, maxSize, fctx);
    if (progress != null) {
      progress.removeListener(fetchListener);
    }
  }
View Full Code Here

Examples of freenet.clients.http.FProxyFetchInProgress

  @Override
  public void updateState(boolean initial) {
    children.clear();

    FProxyFetchInProgress progress = tracker.getFetchInProgress(key, maxSize, fctx);
    FProxyFetchWaiter waiter = progress == null ? null : progress.getWaiter();
    FProxyFetchResult fr = waiter == null ? null : waiter.getResult();
    if (fr == null) {
      addChild("div", "No fetcher found");
    } else {
      if (fr.isFinished() || fr.hasData() || fr.failed != null) {
        // If finished then we just send a FINISHED text. It will reload the page
        setContent(UpdaterConstants.FINISHED);
      } else {
        int total = fr.requiredBlocks;
        int fetchedPercent = (int) (fr.fetchedBlocks / (double) total * 100);
        int failedPercent = (int) (fr.failedBlocks / (double) total * 100);
        int fatallyFailedPercent = (int) (fr.fatallyFailedBlocks / (double) total * 100);
        HTMLNode progressBar = addChild("div", "class", "progressbar");
        progressBar.addChild("div", new String[] { "class", "style" }, new String[] { "progressbar-done", "width: " + fetchedPercent + "%;" });
       
        if (fr.failedBlocks > 0)
          progressBar.addChild("div", new String[] { "class", "style" }, new String[] { "progressbar-failed", "width: " + failedPercent + "%;" });
        if (fr.fatallyFailedBlocks > 0)
          progressBar.addChild("div", new String[] { "class", "style" }, new String[] { "progressbar-failed2", "width: " + fatallyFailedPercent + "%;" });
       
        NumberFormat nf = NumberFormat.getInstance();
        nf.setMaximumFractionDigits(1);
        String prefix = '('+Integer.toString(fr.fetchedBlocks) + "/ " + Integer.toString(total)+"): ";
        if (fr.finalizedBlocks) {
          progressBar.addChild("div", new String[] { "class", "title" }, new String[] { "progress_fraction_finalized", prefix + NodeL10n.getBase().getString("QueueToadlet.progressbarAccurate") }, nf.format((int) ((fr.fetchedBlocks / (double) total) * 1000) / 10.0) + '%');
        } else {
          String text = nf.format((int) ((fr.fetchedBlocks / (double) total) * 1000) / 10.0)+ '%';
          text = "" + fr.fetchedBlocks + " ("+text+"??)";
          progressBar.addChild("div", new String[] { "class", "title" }, new String[] { "progress_fraction_not_finalized", prefix + NodeL10n.getBase().getString("QueueToadlet.progressbarNotAccurate") }, text);
        }
      }
    }
    if (waiter != null) {
      progress.close(waiter);
    }
    if (fr != null) {
      progress.close(fr);
    }
  }
View Full Code Here

Examples of freenet.clients.http.FProxyFetchInProgress

  }

  @Override
  public void dispose() {
    // Deregisters the FetchListener
    FProxyFetchInProgress progress = tracker.getFetchInProgress(key, maxSize, fctx);
    if (progress != null) {
      progress.removeListener(fetchListener);
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.