Java UpdateWorker Example

说明

java updateworker示例是从最受好评的开源项目中提取的实现代码,你可以参考下面示例的使用方式。

编程语言: Java

类/类型: UpdateWorker

示例#1
文件: QuadBootloaderActivity.java项目: cctsao1008/etootle-flight

 private void CleanUpdateWorker() {
   if (mUpdateWorker != null) {
     if (mUpdateWorker.isAlive()) {
       mUpdateWorker.cancel();
     }
   }
 }

示例#2
文件: ConnectorUpdateServiceImpl.java项目: amihalcin/fluxtream-app

  @Override
  @Transactional(readOnly = false)
  public void pollScheduledUpdates() {
    if (isShuttingDown) {
      StringBuilder sb =
          new StringBuilder(
                  "module=updateQueue component=pollScheduledUpdates" + " action=updateConnector")
              .append(" message=\"Service is shutting down... Stopping Task Queue polling...\"");
      logger.warn(sb.toString());
      return;
    }
    List<UpdateWorkerTask> updateWorkerTasks =
        JPAUtils.find(
            em,
            UpdateWorkerTask.class,
            "updateWorkerTasks.byStatus",
            Status.SCHEDULED,
            System.currentTimeMillis());
    if (updateWorkerTasks.size() == 0) {
      logger.debug(
          "module=updateQueue component=connectorUpdateService action=pollScheduledUpdates message=\"Nothing to do\"");
      return;
    }
    for (UpdateWorkerTask updateWorkerTask : updateWorkerTasks) {
      logger.info(
          "module=updateQueue component=connectorUpdateService action=pollScheduledUpdates"
              + " message=\"Executing update: "
              + " \""
              + updateWorkerTask);
      setUpdateWorkerTaskStatus(updateWorkerTask.getId(), Status.IN_PROGRESS);

      // TODO: re-think this through
      // retrieve updater for the worker
      // find out wether such an update task is already running
      // if not create the worker
      // let the updater know about the worker
      // execute the worker

      UpdateWorker updateWorker = beanFactory.getBean(UpdateWorker.class);
      updateWorker.task = updateWorkerTask;
      try {
        executor.execute(updateWorker);
      } catch (Throwable t) {
        t.printStackTrace();
      }
    }
  }

示例#3
文件: QuadBootloaderActivity.java项目: cctsao1008/etootle-flight

 int onWriting(byte[] param) {
   if (param.length < 4) return -1;
   //
   int blocksWritten = MyMath.toInt(param);
   // for(int i=0;i<4;i++)
   //    ((uint8_t *)&blocksWritten)[i] = param[i];
   //
   // int value = ui->progressBar->maximum() * blocksWritten / m_fileReader.getBlocksAmount();
   // ui->progressBar->setValue(value);
   if (mUpdateWorker != null && mUpdateWorker.isAlive()) {
     setProgress(blocksWritten, mFileReader.getBlocksAmount());
   }
   //
   return 0;
 }

示例#4
文件: QuadBootloaderActivity.java项目: cctsao1008/etootle-flight

 private void update() {
   CleanUpdateWorker();
   mUpdateWorker = new UpdateWorker();
   mUpdateWorker.start();
 }

示例#5
文件: IPAToolAppWnd.java项目: jzarzuela/eclipse-projects-set

 private void updateIPAs() {
   _executionStarted();
   UpdateWorker uw = new UpdateWorker(m_monitor);
   uw.update(m_txtExistingFolder.getText(), m_txtUpdFolder.getText(), m_txtITunesFolder.getText());
 }

展开阅读全文