public void initIndex() throws Exception {
    try {
      Files.createDirectories(updateLocation);
    } catch (Exception a) {
      // ignore
    }
    long startUpdate = System.currentTimeMillis();
    System.out.println("fetching updates ");
    updateIndex();
    long span = System.currentTimeMillis() - startUpdate;
    System.out.println("done updates index - time taken = " + span);
    i = new Index(updateLocation.resolve("index.json"));

    LinkedList<Runnable> updateOperations = new LinkedList<>();
    for (SmallModuleEntry sme : i.getSmallModuleEntrys()) {
      LocallyPresent locallyPresent = UploaderPlugin.locallyPresent(updateLocation, sme);
      if (locallyPresent != LocallyPresent.ABSENT) {
        if (sme.isDead()) {
          deleteLocal(sme); // dead plugins get cleaned. :D
        } else {
          updateOperations.add(loadInNewThread(sme));
        }
      }
    }
    ReactiveThread rt =
        ReactiveThread.create(
            CompletionCallback.DUMMY,
            "Updating all plugins",
            updateOperations.toArray(new Runnable[updateOperations.size()]));
    rt.setDaemon(true);
    rt.start();
  }
  private void updateIndex() throws Exception {
    final Content c = upui.addContent("Updating list of supported file host");
    final ReactiveThread rt1 =
        ReactiveThread.create(
            new Runnable() {
              @Override
              public void run() {
                try {
                  HttpUtil.update(
                      "http://www.neembuu.com/uploader/updates/v3.1/update.zip",
                      updateLocation.resolve("update.zip"),
                      c);
                  ReactiveThread.get().updateProgress(0.7d);
                  ZipFSClassLoader.quickExtract(updateLocation.resolve("update.zip"));
                  CheckMajorUpdate cu = new CheckMajorUpdate(updateLocation, sun);
                  cu.check();
                } catch (Exception a) {
                  throw new IllegalStateException(a);
                }
              }
            },
            new CompletionCallback() {
              @Override
              public void completed(ReactiveThread rt) {
                c.done();
              }

              @Override
              public void canceled(ReactiveThread rt) {
                c.done();
              }

              @Override
              public void progressed(ReactiveThread rt) {
                c.setProgress(rt.getProgress());
              }
            });
    rt1.start();

    if (!waitTill(rt1, 20 * 1000, 300, 0.6)) {
      rt1.cancel();
    }
  }