• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Method类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.google.appengine.api.taskqueue.TaskOptions.Method的典型用法代码示例。如果您正苦于以下问题:Java Method类的具体用法?Java Method怎么用?Java Method使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Method类属于com.google.appengine.api.taskqueue.TaskOptions包,在下文中一共展示了Method类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: scheduleNotificationBuild

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
public static void scheduleNotificationBuild(String objectType, Long id,
		String action) {
	if (objectType == null || objectType.isEmpty()) {
		throw new IllegalArgumentException("No Specified Object Type");
	}

	if (id == null) {
		throw new IllegalArgumentException("No Specified Object Id");
	}

	if (action == null || action.isEmpty()) {
		throw new IllegalArgumentException("No Action Specified");
	}

	// Execute the servlet to pull from the queue
	Queue executionQueue = QueueFactory.getQueue("notification-building");
	executionQueue.add(TaskOptions.Builder
			.withUrl("/notifications/builder/").method(Method.GET)
			.param("objectType", objectType)
			.param("id", String.valueOf(id.longValue()))
			.param("action", action));

}
 
开发者ID:pschuette22,项目名称:Zeppa-AppEngine,代码行数:24,代码来源:NotificationUtility.java


示例2: enqueueDomainResourceTask

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
/**
 * Enqueues a task in the LORDN queue representing a line of CSV for LORDN export.
 */
public static void enqueueDomainResourceTask(DomainResource domain) {
  ofy().assertInTransaction();
  // This method needs to use ofy transactionTime as the DomainResource's creationTime because
  // CreationTime isn't yet populated when this method is called during the resource flow.
  String tld = domain.getTld();
  if (domain.getLaunchNotice() == null) {
    getQueue(QUEUE_SUNRISE).add(TaskOptions.Builder
        .withTag(tld)
        .method(Method.PULL)
        .payload(getCsvLineForSunriseDomain(domain, ofy().getTransactionTime())));
  } else {
    getQueue(QUEUE_CLAIMS).add(TaskOptions.Builder
        .withTag(tld)
        .method(Method.PULL)
        .payload(getCsvLineForClaimsDomain(domain, ofy().getTransactionTime())));
  }
}
 
开发者ID:google,项目名称:nomulus,代码行数:21,代码来源:LordnTask.java


示例3: enqueueAsyncDelete

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
/** Enqueues a task to asynchronously delete a contact or host, by key. */
public void enqueueAsyncDelete(
    EppResource resourceToDelete,
    DateTime now,
    String requestingClientId,
    Trid trid,
    boolean isSuperuser) {
  Key<EppResource> resourceKey = Key.create(resourceToDelete);
  logger.infofmt(
      "Enqueuing async deletion of %s on behalf of registrar %s.",
      resourceKey, requestingClientId);
  TaskOptions task =
      TaskOptions.Builder.withMethod(Method.PULL)
          .countdownMillis(asyncDeleteDelay.getMillis())
          .param(PARAM_RESOURCE_KEY, resourceKey.getString())
          .param(PARAM_REQUESTING_CLIENT_ID, requestingClientId)
          .param(PARAM_CLIENT_TRANSACTION_ID, trid.getClientTransactionId())
          .param(PARAM_SERVER_TRANSACTION_ID, trid.getServerTransactionId())
          .param(PARAM_IS_SUPERUSER, Boolean.toString(isSuperuser))
          .param(PARAM_REQUESTED_TIME, now.toString());
  addTaskToQueueWithRetry(asyncDeletePullQueue, task);
}
 
开发者ID:google,项目名称:nomulus,代码行数:23,代码来源:AsyncFlowEnqueuer.java


示例4: makeTaskOptions

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的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


示例5: testSuccess_enqueuePollTask_withChainedTask

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
@Test
public void testSuccess_enqueuePollTask_withChainedTask() throws Exception {
  TaskOptions chainedTask = TaskOptions.Builder
      .withUrl("/_dr/something")
      .method(Method.POST)
      .header("X-Testing", "foo")
      .param("testing", "bar");
  new BigqueryPollJobEnqueuer(ENQUEUER).enqueuePollTask(
      new JobReference().setProjectId(PROJECT_ID).setJobId(JOB_ID),
      chainedTask,
      getQueue(CHAINED_QUEUE_NAME));
  assertTasksEnqueued(BigqueryPollJobAction.QUEUE, newPollJobTaskMatcher("POST"));
  TaskStateInfo taskInfo = getOnlyElement(
      TaskQueueHelper.getQueueInfo(BigqueryPollJobAction.QUEUE).getTaskInfo());
  ByteArrayInputStream taskBodyBytes = new ByteArrayInputStream(taskInfo.getBodyAsBytes());
  TaskOptions taskOptions = (TaskOptions) new ObjectInputStream(taskBodyBytes).readObject();
  assertThat(taskOptions).isEqualTo(chainedTask);
}
 
开发者ID:google,项目名称:nomulus,代码行数:19,代码来源:BigqueryPollJobActionTest.java


示例6: queueToIndex

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
/**
 * @param name
 * @param id
 */
public static void queueToIndex (String name, Long id) {
	Queue queue = QueueFactory.getDefaultQueue();

	TaskOptions options = TaskOptions.Builder.withMethod(Method.POST)
			.url(INDEX_SEARCH_URL).param(ENTITY_NAME_KEY, name)
			.param(ENTITY_ID_KEY, id.toString());

	int retry = RETRY_COUNT;
	do {
		try {
			queue.add(options);

			// success no need to retry
			retry = 0;
		} catch (TransientFailureException ex) {
			retry--;
		}
	} while (retry > 0);
}
 
开发者ID:billy1380,项目名称:blogwt,代码行数:24,代码来源:SearchHelper.java


示例7: reset

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
/**
 * Reset reservations in datastore to match those in RTDB. Reservations in RTDB are used
 * as the source of truth, corresponding reservations in datastore are updated to match
 * those in RTDB. Reservations in RTDB that do not exist in datastore are added to datastore.
 * Reservations that exist in datastore and do not exist in RTDB are updated in datastore
 * with status DELETED.
 *
 * Use of this endpoint should be followed by a user data sync.
 *
 * @param user User making request (injected by Endpoints)
 */
@ApiMethod(name = "reset", path = "reset")
public void reset(User user)
    throws UnauthorizedException {
  if (user == null) {
    throw new UnauthorizedException("Invalid credentials");
  }

  // Add Sync Reservations worker to queue.
  Queue queue = QueueFactory.getQueue("SyncReservationsQueue");

  TaskOptions taskOptions = TaskOptions.Builder
      .withUrl("/queue/syncres")
      .method(Method.GET);
  queue.add(taskOptions);
}
 
开发者ID:google,项目名称:iosched,代码行数:27,代码来源:ReservationsEndpoint.java


示例8: doGet

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
  String channelKey = getChannelKey();
  String filterText = req.getParameter("filterText");
  filterText = (filterText == null) ? "" : filterText;
  String tag = req.getParameter("tag");
  String requestId = req.getParameter("reqId");
  String userId = userService.getCurrentUser().getUserId();

  Queue queue = QueueFactory.getDefaultQueue();
  TaskOptions taskOptions = withUrl("/fetch")
      .param("displayStyle", req.getParameter("displayStyle"))
      .param("filterText", filterText)
      .param("key", channelKey)
      .param("networkCode", req.getParameter("networkCode"))
      .param("userId", userId)
      .param("tag", tag)
      .param("reqId", requestId)
      .param("typeOverride", req.getParameter("typeOverride"));

  queue.add(taskOptions.method(Method.GET));
  resp.getWriter().print(channelKey);
}
 
开发者ID:googleads,项目名称:googleads-dfp-java-dfp-playground,代码行数:24,代码来源:TaskDispatchServlet.java


示例9: watchFolderChanges

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
public Channel watchFolderChanges(Drive driveService, Project project) throws IOException {
	
	Channel channel = new Channel();
    channel.setId(java.util.UUID.randomUUID().toString());
    channel.setToken(project.getKey());
    channel.setType("web_hook");
    channel.setAddress(API.getBaseUrl()+"/webhook/receiveFolderChanges");
    long expirationMillis = 86400000; // 1day
    channel.setExpiration( (new Date()).getTime() + expirationMillis);
    
    // task for renewing watch channel
    Queue queue = QueueFactory.getDefaultQueue();
    TaskOptions task = TaskOptions.Builder
    	.withUrl(AppHelper.getTaskBaseUrl()+"/watchFolderChanges")
    	.countdownMillis(expirationMillis)
    	.param("project", project.getKey())
    	.param("user", project.getOwner().getKey().getString())
    	.method(Method.POST)
    ; 
       queue.add(task);
       
       return driveService.files().watch(project.getFolder(),channel).execute();
}
 
开发者ID:andryfailli,项目名称:teampot,代码行数:24,代码来源:ProjectService.java


示例10: spoonPollEndTask

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
private void spoonPollEndTask(Meeting meeting) {
	
	String taskName = "pollEnd_"+meeting.getKey();
	
	this.removePollEndTask(meeting);
	
	if (meeting.getPoll().getEndDate() != null && !meeting.getPoll().isEnded()) {
				
		Queue queue = QueueFactory.getDefaultQueue();
	    TaskOptions task = TaskOptions.Builder
	    	.withUrl(AppHelper.getTaskBaseUrl()+"/pollEnd")
	    	.etaMillis(meeting.getPoll().getEndDate().getTime())
	    	.param("meeting", meeting.getKey())
	    	.method(Method.POST)
	    	.taskName(taskName)
	    ; 
	    
        queue.add(task);
       
	}
}
 
开发者ID:andryfailli,项目名称:teampot,代码行数:22,代码来源:MeetingService.java


示例11: createBackupTaskOptions

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的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


示例12: enqueueAsyncDnsRefresh

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
/** Enqueues a task to asynchronously refresh DNS for a renamed host. */
public void enqueueAsyncDnsRefresh(HostResource host, DateTime now) {
  Key<HostResource> hostKey = Key.create(host);
  logger.infofmt("Enqueuing async DNS refresh for renamed host %s.", hostKey);
  addTaskToQueueWithRetry(
      asyncDnsRefreshPullQueue,
      TaskOptions.Builder.withMethod(Method.PULL)
          .param(PARAM_HOST_KEY, hostKey.getString())
          .param(PARAM_REQUESTED_TIME, now.toString()));
}
 
开发者ID:google,项目名称:nomulus,代码行数:11,代码来源:AsyncFlowEnqueuer.java


示例13: addToQueue

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
/**
 * Enqueues the given task type with the given target name to the DNS queue.
 */
private TaskHandle addToQueue(TargetType targetType, String targetName, String tld) {
  logger.infofmt(
      "Adding task type=%s, target=%s, tld=%s to pull queue %s (%d tasks currently on queue)",
      targetType, targetName, tld, DNS_PULL_QUEUE_NAME, queue.fetchStatistics().getNumTasks());
  return queue.add(TaskOptions.Builder
      .withDefaults()
      .method(Method.PULL)
      .param(DNS_TARGET_TYPE_PARAM, targetType.toString())
      .param(DNS_TARGET_NAME_PARAM, targetName)
      .param(PARAM_TLD, tld));
}
 
开发者ID:google,项目名称:nomulus,代码行数:15,代码来源:DnsQueue.java


示例14: enqueuePollTask

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
/**
 * Enqueue a task to poll for the success or failure of the referenced BigQuery job and to
 * launch the provided task in the specified queue if the job succeeds.
 */
public TaskHandle enqueuePollTask(
    JobReference jobRef, TaskOptions chainedTask, Queue chainedTaskQueue) throws IOException {
  // Serialize the chainedTask into a byte array to put in the task payload.
  ByteArrayOutputStream taskBytes = new ByteArrayOutputStream();
  new ObjectOutputStream(taskBytes).writeObject(chainedTask);
  return enqueuer.enqueue(
      getQueue(QUEUE),
      createCommonPollTask(jobRef)
          .method(Method.POST)
          .header(CHAINED_TASK_QUEUE_HEADER, chainedTaskQueue.getQueueName())
          .payload(taskBytes.toByteArray()));
}
 
开发者ID:google,项目名称:nomulus,代码行数:17,代码来源:BigqueryPollJobAction.java


示例15: createViewUpdateTask

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
/** Create a task for updating a snapshot view. */
static TaskOptions createViewUpdateTask(String datasetId, String tableId, String kindName) {
  return TaskOptions.Builder.withUrl(PATH)
      .method(Method.POST)
      .param(UPDATE_SNAPSHOT_DATASET_ID_PARAM, datasetId)
      .param(UPDATE_SNAPSHOT_TABLE_ID_PARAM, tableId)
      .param(UPDATE_SNAPSHOT_KIND_PARAM, kindName);
}
 
开发者ID:google,项目名称:nomulus,代码行数:9,代码来源:UpdateSnapshotViewAction.java


示例16: enqueuePollTask

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
/** Enqueue a poll task to monitor the named snapshot for completion. */
static TaskHandle enqueuePollTask(String snapshotName, ImmutableSet<String> kindsToLoad) {
  return QueueFactory.getQueue(QUEUE)
      .add(
          TaskOptions.Builder.withUrl(PATH)
              .method(Method.POST)
              .countdownMillis(POLL_COUNTDOWN.getMillis())
              .param(CHECK_SNAPSHOT_NAME_PARAM, snapshotName)
              .param(CHECK_SNAPSHOT_KINDS_TO_LOAD_PARAM, Joiner.on(',').join(kindsToLoad)));
}
 
开发者ID:google,项目名称:nomulus,代码行数:11,代码来源:CheckSnapshotAction.java


示例17: enqueueLoadSnapshotTask

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
/** Enqueue a task for starting a backup load. */
public static TaskHandle enqueueLoadSnapshotTask(
    String snapshotId, String gcsFile, ImmutableSet<String> kinds) {
  return getQueue(QUEUE).add(
      TaskOptions.Builder.withUrl(PATH)
          .method(Method.POST)
          .param(LOAD_SNAPSHOT_ID_PARAM, snapshotId)
          .param(LOAD_SNAPSHOT_FILE_PARAM, gcsFile)
          .param(LOAD_SNAPSHOT_KINDS_PARAM, Joiner.on(',').join(kinds)));
}
 
开发者ID:google,项目名称:nomulus,代码行数:11,代码来源:LoadSnapshotAction.java


示例18: makeTaskHandle

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
private static TaskHandle makeTaskHandle(
    String taskName,
    String tag,
    String payload,
    String queue) {
  return new TaskHandle(
      TaskOptions.Builder.withPayload(payload).method(Method.PULL).tag(tag).taskName(taskName),
      queue);
}
 
开发者ID:google,项目名称:nomulus,代码行数:10,代码来源:LordnTaskTest.java


示例19: testSuccess_unparseableTasks_areDelayedForADay

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的package包/类
@Test
public void testSuccess_unparseableTasks_areDelayedForADay() throws Exception {
  TaskOptions task =
      TaskOptions.Builder.withMethod(Method.PULL).param("gobbledygook", "kljhadfgsd9f7gsdfh");
  getQueue(QUEUE_ASYNC_DELETE).add(task);
  runMapreduce();
  assertTasksEnqueued(
      QUEUE_ASYNC_DELETE,
      new TaskMatcher()
          .payload("gobbledygook=kljhadfgsd9f7gsdfh")
          .etaDelta(standardHours(23), standardHours(25)));
  verify(action.asyncFlowMetrics).recordContactHostDeletionBatchSize(1L);
  verifyNoMoreInteractions(action.asyncFlowMetrics);
}
 
开发者ID:google,项目名称:nomulus,代码行数:15,代码来源:DeleteContactsAndHostsActionTest.java


示例20: createRefreshTask

import com.google.appengine.api.taskqueue.TaskOptions.Method; //导入依赖的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



注:本文中的com.google.appengine.api.taskqueue.TaskOptions.Method类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SafeStyles类代码示例发布时间:2022-05-22
下一篇:
Java BlockPoolTokenSecretManager类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap