當前位置: 首頁>>代碼示例>>Java>>正文


Java TaskOptions.param方法代碼示例

本文整理匯總了Java中com.google.appengine.api.taskqueue.TaskOptions.param方法的典型用法代碼示例。如果您正苦於以下問題:Java TaskOptions.param方法的具體用法?Java TaskOptions.param怎麽用?Java TaskOptions.param使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.appengine.api.taskqueue.TaskOptions的用法示例。


在下文中一共展示了TaskOptions.param方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: export

import com.google.appengine.api.taskqueue.TaskOptions; //導入方法依賴的package包/類
public void export(BigQueryMetric metric) {
  try {
    String hostname = modulesService.getVersionHostname("backend", null);
    TaskOptions opts =
        withUrl(MetricsExportAction.PATH)
            .header("Host", hostname)
            .param("insertId", idGenerator.get());
    for (Entry<String, String> entry : metric.getBigQueryRowEncoding().entrySet()) {
      opts.param(entry.getKey(), entry.getValue());
    }
    opts.param("tableId", metric.getTableId());
    queue.add(opts);
  } catch (TransientFailureException e) {
    // Log and swallow. We may drop some metrics here but this should be rare.
    logger.info(e, e.getMessage());
  }
}
 
開發者ID:google,項目名稱:nomulus,代碼行數:18,代碼來源:BigQueryMetricsEnqueuer.java

示例2: makeTaskOptions

import com.google.appengine.api.taskqueue.TaskOptions; //導入方法依賴的package包/類
/**
 * Generates the TaskOptions needed to trigger an AppEngine Datastore backup job.
 *
 * @see <a href="https://developers.google.com/appengine/articles/scheduled_backups">Scheduled Backups</a>
 */
private static TaskOptions makeTaskOptions(
    String queue, String name, String gcsBucket, ImmutableSet<String> kinds) {
  String hostname = modulesService.getVersionHostname("default", DATASTORE_ADMIN_VERSION_NAME);
  TaskOptions options = TaskOptions.Builder.withUrl("/_ah/datastore_admin/backup.create")
      .header("Host", hostname)
      .method(Method.GET)
      .param("name", name + "_")  // Add underscore since the name will be used as a prefix.
      .param("filesystem", "gs")
      .param("gs_bucket_name", gcsBucket)
      .param("queue", queue);
  for (String kind : kinds) {
    options.param("kind", kind);
  }
  return options;
}
 
開發者ID:google,項目名稱:nomulus,代碼行數:21,代碼來源:DatastoreBackupService.java

示例3: enqueueTask

import com.google.appengine.api.taskqueue.TaskOptions; //導入方法依賴的package包/類
@Override
public void enqueueTask(String taskName, Map<String, String[]> paramMap) {

  checkNotNull(taskName);

  final Queue queue = QueueFactory.getDefaultQueue();
  final TaskOptions options = TaskOptions.Builder.withUrl(String.format(PATH_ADMIN_TASK, taskName));

  for (Map.Entry<String, String[]> param : paramMap.entrySet()) {
    for (String value : param.getValue()) {
      options.param(param.getKey(), value);
    }
  }

  try {
    queue.add(options);
    LOGGER.info("Added admin task to queue {}", taskName);
  } catch (TransientFailureException tfe) {
    LOGGER.error("Run admin task fail {} ", tfe.getMessage());
  }

}
 
開發者ID:Wadpam,項目名稱:guja,代碼行數:23,代碼來源:GAEAdminTaskQueue.java

示例4: addDeferredTask

import com.google.appengine.api.taskqueue.TaskOptions; //導入方法依賴的package包/類
/**
 * Adds the given task, to be run after the specified time, to the specified queue.
 *
 * @param task the task object containing the details of task to be added
 * @param countdownTime the time delay for the task to be executed
 */
public void addDeferredTask(TaskWrapper task, long countdownTime) {
    Queue requiredQueue = QueueFactory.getQueue(task.getQueueName());
    TaskOptions taskToBeAdded = TaskOptions.Builder.withUrl(task.getWorkerUrl());
    if (countdownTime > 0) {
        taskToBeAdded.countdownMillis(countdownTime);
    }

    for (Map.Entry<String, String[]> entry : task.getParamMap().entrySet()) {
        String name = entry.getKey();
        String[] values = entry.getValue();

        for (String value : values) {
            taskToBeAdded = taskToBeAdded.param(name, value);
        }
    }

    requiredQueue.add(taskToBeAdded);
}
 
開發者ID:TEAMMATES,項目名稱:teammates,代碼行數:25,代碼來源:TaskQueuesLogic.java

示例5: createBackupTaskOptions

import com.google.appengine.api.taskqueue.TaskOptions; //導入方法依賴的package包/類
private TaskOptions createBackupTaskOptions(String backupName, List<String> kindsToExport, String bucketName, String queueName) {
	TaskOptions t = TaskOptions.Builder.withUrl("/_ah/datastore_admin/backup.create");
	t.param("name", backupName);
	for (String kind : kindsToExport) {
		t.param("kind", kind);
	}
	t.param("filesystem", "gs");
	t.param("gs_bucket_name", bucketName);
	
	t.param("queue", queueName);
	
	t.method(Method.GET);
	t.header("Host", BackendServiceFactory.getBackendService().getBackendAddress(AH_BUILTIN_PYTHON_BUNDLE));
	
	return t;
}
 
開發者ID:steveseo,項目名稱:l2bq,代碼行數:17,代碼來源:BuiltinDatastoreToBigqueryCronTask.java

示例6: requestMagicLink

import com.google.appengine.api.taskqueue.TaskOptions; //導入方法依賴的package包/類
public void requestMagicLink(String loginIdentifier, String next) {
    Route route = router.getNamedRoute("task.notify.sendMagicLink");
    TaskOptions taskOptions = TaskOptions.Builder
        .withUrl(route.getRoute())
        .param("loginIdentifier", loginIdentifier);
    if (next != null) {
        taskOptions = taskOptions.param("next", next);
    }
    queue.add(ofy().getTransaction(), taskOptions);
}
 
開發者ID:3wks,項目名稱:generator-thundr-gae-react,代碼行數:11,代碼來源:MagicLinkService.java

示例7: createRefreshTask

import com.google.appengine.api.taskqueue.TaskOptions; //導入方法依賴的package包/類
private static TaskOptions createRefreshTask(String name, TargetType type) {
  TaskOptions options = TaskOptions.Builder
      .withMethod(Method.PULL)
      .param(DNS_TARGET_TYPE_PARAM, type.toString())
      .param(DNS_TARGET_NAME_PARAM, name);
  String tld = InternetDomainName.from(name).parts().reverse().get(0);
  return options.param("tld", tld);
}
 
開發者ID:google,項目名稱:nomulus,代碼行數:9,代碼來源:ReadDnsQueueActionTest.java

示例8: register_customTask

import com.google.appengine.api.taskqueue.TaskOptions; //導入方法依賴的package包/類
/**
 * Registers a custom task in the custom queue.
 * @param paramMap map of parameters to store
 */
public static void register_customTask( final java.util.Map< String, String > paramMap ) {
	final TaskOptions taskOptions = buildTask( OPERATION_CUSTOM );
	
	for ( final Entry< String, String > paramEntry : paramMap.entrySet() )
		taskOptions.param( paramEntry.getKey(), paramEntry.getValue() );
	
	QueueFactory.getQueue( QUEUE_NAME_CUSTOM ).add( taskOptions );
}
 
開發者ID:icza,項目名稱:sc2gears,代碼行數:13,代碼來源:TaskServlet.java

示例9: queueTask

import com.google.appengine.api.taskqueue.TaskOptions; //導入方法依賴的package包/類
public void queueTask(String url, String cursorStr) {
    TaskOptions taskOptions = TaskOptions.Builder
            .withMethod(TaskOptions.Method.GET)
            .url(url)
            .retryOptions(RetryOptions.Builder.withTaskRetryLimit(0));

    if(cursorStr != null) {
        taskOptions.param("cursor", cursorStr);
    }

    Queue queue = QueueFactory.getDefaultQueue();
    queue.add(taskOptions);
}
 
開發者ID:ipeirotis,項目名稱:mturk-surveys,代碼行數:14,代碼來源:MergeAnswersServlet.java

示例10: queueTask

import com.google.appengine.api.taskqueue.TaskOptions; //導入方法依賴的package包/類
public static void queueTask(String url, String hitId) {
    TaskOptions taskOptions = TaskOptions.Builder
            .withMethod(TaskOptions.Method.GET)
            .url(url)
            .retryOptions(RetryOptions.Builder.withTaskRetryLimit(0));

    if(hitId != null) {
        taskOptions.param("hitId", hitId);
    }

    Queue queue = QueueFactory.getDefaultQueue();
    queue.add(taskOptions);
}
 
開發者ID:ipeirotis,項目名稱:mturk-surveys,代碼行數:14,代碼來源:AddHitCreationDateToUserAnswerServlet.java

示例11: queueTask

import com.google.appengine.api.taskqueue.TaskOptions; //導入方法依賴的package包/類
public void queueTask(String surveyId, boolean production) {
    TaskOptions taskOptions = TaskOptions.Builder
            .withMethod(TaskOptions.Method.GET)
            .url("/tasks/createHIT")
            .retryOptions(RetryOptions.Builder.withTaskRetryLimit(0));

    taskOptions.param("surveyId", surveyId);
    taskOptions.param("production", String.valueOf(production));

    Queue queue = QueueFactory.getDefaultQueue();
    queue.add(taskOptions);
}
 
開發者ID:ipeirotis,項目名稱:mturk-surveys,代碼行數:13,代碼來源:CreateHITServlet.java

示例12: enqueueTask

import com.google.appengine.api.taskqueue.TaskOptions; //導入方法依賴的package包/類
private static void enqueueTask(String baseUrl, BuiltinDatastoreExportConfiguration exporterConfig, long timestamp, long countdownMillis) {
	TaskOptions t = TaskOptions.Builder.withUrl(baseUrl + BUILTIN_DATASTORE_TO_BIGQUERY_INGESTOR_TASK_PATH);
	t.param(AnalysisConstants.TIMESTAMP_PARAM, Long.toString(timestamp));
	t.param(AnalysisConstants.BUILTIN_DATASTORE_EXPORT_CONFIG, exporterConfig.getClass().getName());
	
	t.method(Method.GET);
	if (countdownMillis > 0) {
		t.countdownMillis(countdownMillis);
	}
	QueueFactory.getQueue(exporterConfig.getQueueName()).add(t);
}
 
開發者ID:steveseo,項目名稱:l2bq,代碼行數:12,代碼來源:BuiltinDatastoreToBigqueryIngesterTask.java

示例13: perform

import com.google.appengine.api.taskqueue.TaskOptions; //導入方法依賴的package包/類
@Override
public Page perform(HttpServletRequest req, HttpServletResponse resp)
		throws IOException {
	String cursor = req.getParameter("cursor");

	Objectify ob = DefaultServlet.getObjectify();
	Query<PackageVersion> q = ob.query(PackageVersion.class);
	if (cursor != null)
		q.startCursor(Cursor.fromWebSafeString(cursor));
	q.limit(100);

	QueryResultIterator<PackageVersion> iterator = q.iterator();

	int n = 0;
	List<PackageVersion> list = new ArrayList<PackageVersion>();
	while (iterator.hasNext()) {
		PackageVersion data = iterator.next();
		list.add(data);
		n++;
	}

	ob.put(list);

	if (n == 100) {
		cursor = iterator.getCursor().toWebSafeString();
	} else {
		cursor = null;
		NWUtils.sendMailToAdmin("cursor == nul for /tasks/resave-package-version");
	}

	Queue queue = QueueFactory.getQueue("resave");
	try {
		TaskOptions to = withUrl("/tasks/resave-package-versions");
		if (cursor != null)
			to.param("cursor", cursor);

		queue.add(to);
	} catch (TaskAlreadyExistsException e) {
		NWUtils.LOG
				.warning("task /tasks/resave-package-version already exists");
	}

	resp.setStatus(200);
	return null;
}
 
開發者ID:tim-lebedkov,項目名稱:npackd-gae-web,代碼行數:46,代碼來源:ForEachPackageVersionAction.java

示例14: perform

import com.google.appengine.api.taskqueue.TaskOptions; //導入方法依賴的package包/類
@Override
public Page perform(HttpServletRequest req, HttpServletResponse resp)
        throws IOException {
    String cursor = req.getParameter("cursor");

    Objectify ob = DefaultServlet.getObjectify();
    Query<Package> q = ob.query(Package.class);
    if (cursor != null) {
        q.startCursor(Cursor.fromWebSafeString(cursor));
    }
    q.limit(1);

    QueryResultIterator<Package> iterator = q.iterator();
    Package data;
    if (iterator.hasNext()) {
        data = iterator.next();
    } else {
        data = null;
    }
    if (data != null) {
        Package old = data.copy();
        NWUtils.LOG.log(Level.INFO, "check-update for {0}", data.name);
        Date noUpdatesCheck = null;
        if ("0".equals(req.getHeader("X-AppEngine-TaskRetryCount"))) {
            try {
                Version v = data.findNewestVersion();
                List<PackageVersion> versions = data.getSortedVersions(ob);
                if (versions.size() > 0) {
                    PackageVersion pv = versions.get(versions.size() - 1);
                    int r = v.compare(Version.parse(pv.version));
                    if (r == 0) {
                        noUpdatesCheck = NWUtils.newDate();
                    } else if (r > 0) {
                        data.createDetectedVersion(ob, v, 0);
                    }
                }
            } catch (IOException e) {
                // ignore
            }
        }

        if (noUpdatesCheck != null || data.noUpdatesCheck != null) {
            data.noUpdatesCheck = noUpdatesCheck;
            NWUtils.savePackage(ob, old, data, false);
        }

        NWUtils.LOG.log(Level.INFO, "check-update noUpdatesCheck= {0}",
                data.noUpdatesCheck);

        cursor = iterator.getCursor().toWebSafeString();
    } else {
        cursor = null;
    }

    Queue queue = QueueFactory.getQueue("check-update");
    TaskOptions to = withUrl("/tasks/check-update");
    if (cursor != null) {
        to.param("cursor", cursor);
    }

    // 2 minutes
    to.countdownMillis(2 * 60 * 1000);

    // NWUtils.LOG.warning("adding task at cursor " + cursor);
    queue.add(to);

    resp.setStatus(200);
    return null;
}
 
開發者ID:tim-lebedkov,項目名稱:npackd-gae-web,代碼行數:70,代碼來源:CheckUpdatesAction.java

示例15: addProperties

import com.google.appengine.api.taskqueue.TaskOptions; //導入方法依賴的package包/類
private static void addProperties(TaskOptions taskOptions, Properties properties) {
  for (String paramName : properties.stringPropertyNames()) {
    String paramValue = properties.getProperty(paramName);
    taskOptions.param(paramName, paramValue);
  }
}
 
開發者ID:GoogleCloudPlatform,項目名稱:appengine-pipelines,代碼行數:7,代碼來源:AppEngineTaskQueue.java


注:本文中的com.google.appengine.api.taskqueue.TaskOptions.param方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。