com.google.appengine.api.taskqueue.DeferredTask Java Examples
The following examples show how to use
com.google.appengine.api.taskqueue.DeferredTask.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TaskQueueServlet.java From appengine-java-vm-runtime with Apache License 2.0 | 6 votes |
private static void deferredTask(HttpServletRequest req, HttpServletResponse resp) throws IOException { String queue = req.getParameter("queue"); Queue q; if (queue == null) { q = QueueFactory.getDefaultQueue(); } else { q = QueueFactory.getQueue(queue); } final String data = req.getParameter("deferredData"); TaskOptions opts = TaskOptions.Builder.withPayload( new DeferredTask() { @Override public void run() { gotCalledBack(data); } }); latch = new CountDownLatch(1); TaskHandle handle = q.add(opts); resp.getWriter().print(handle.getQueueName()); }
Example #2
Source File: DeferredDatastoreSessionStore.java From appengine-java-vm-runtime with Apache License 2.0 | 5 votes |
private static DeferredTask newDeferredTask(Constructor<DeferredTask> ctor, Object arg) { try { return ctor.newInstance(arg); } catch (Exception e) { throw new RuntimeException(e); } }