Examples of TaskHandle


Examples of com.facebook.presto.execution.TaskExecutor.TaskHandle

    {
        TaskExecutor taskExecutor = new TaskExecutor(4);
        taskExecutor.start();

        try {
            TaskHandle taskHandle = taskExecutor.addTask(new TaskId("test", "test", "test"));

            final Phaser beginPhase = new Phaser();
            beginPhase.register();
            final Phaser verificationComplete = new Phaser();
            verificationComplete.register();
View Full Code Here

Examples of com.facebook.presto.execution.TaskExecutor.TaskHandle

    {
        TaskExecutor taskExecutor = new TaskExecutor(4);
        taskExecutor.start();

        try {
            TaskHandle taskHandle = taskExecutor.addTask(new TaskId("test", "test", "test"));

            final Phaser beginPhase = new Phaser();
            beginPhase.register();
            final Phaser verificationComplete = new Phaser();
            verificationComplete.register();
View Full Code Here

Examples of com.facebook.presto.execution.TaskExecutor.TaskHandle

    {
        TaskExecutor taskExecutor = new TaskExecutor(4);
        taskExecutor.start();

        try {
            TaskHandle taskHandle = taskExecutor.addTask(new TaskId("test", "test", "test"));

            final Phaser beginPhase = new Phaser();
            beginPhase.register();
            final Phaser verificationComplete = new Phaser();
            verificationComplete.register();
View Full Code Here

Examples of com.google.appengine.api.labs.taskqueue.TaskHandle

           
            // Task queue implements the exponential backoff
            long jitter = (int) Math.random() * C2DM_MAX_JITTER_MSEC;
            url.countdownMillis(jitter);
           
            TaskHandle add = dmQueue.add(url);
        } catch (UnsupportedEncodingException e) {
            // Ignore - UTF8 should be supported
            log.log(Level.SEVERE, "Unexpected error", e);
        }
       
View Full Code Here

Examples of com.google.appengine.api.taskqueue.TaskHandle

        }
       
        URL uri = new URL(url);
        String path = uri.getPath();   
        Queue queue = QueueFactory.getDefaultQueue();
        TaskHandle task = queue.add(withUrl(path)
            .payload(request.toString())
            .countdownMillis(delay));
       
        // store task information
        DateTime timestamp = DateTime.now().plus(delay);
        GaeTask storedTask = new GaeTask(task.getName(),
            agentId, timestamp.toString());
        ObjectDatastore datastore = new AnnotationObjectDatastore();
        datastore.store(storedTask);
       
        return task.getName();     
      } catch (MalformedURLException e) {
        e.printStackTrace();
      }

      // TODO: throw error?
View Full Code Here

Examples of com.google.appengine.api.taskqueue.TaskHandle

        TaskOptions options = TaskUtils.newTaskOptions(ChunkedRuleProcessor.class)
            .param(pCHUNK_ID, Integer.toString(chunkId))
            .param(pSTART_ID, KeyFactory.keyToString(startKey))
            .param(pLAST_ID, KeyFactory.keyToString(lastKey))
            .param(pCHUNK_SIZE, Long.toString(chunkSize));
        TaskHandle handle = queue.add(options);
        Logger.info("Enq'd new task. Task id: %s Start key: %s Last key: %s",
                handle.getName(), startKey, lastKey);
        return handle;
    }
View Full Code Here

Examples of com.google.appengine.api.taskqueue.TaskHandle

        Queue queue = QueueFactory.getDefaultQueue();

        TaskOptions options = withTaskName(name).payload("payload");
        options.etaMillis(0); // TODO -- remove this once NPE is fixewd

        TaskHandle handle = queue.add(options);

        assertEquals("default", handle.getQueueName());
        assertEquals(name, handle.getName());
        assertEquals("payload", new String(handle.getPayload(), "UTF-8"));
        assertNotNull(handle.getEtaMillis());
        assertEquals(0, (int) handle.getRetryCount());
    }
View Full Code Here

Examples of com.google.appengine.api.taskqueue.TaskHandle

    }

    @Test
    public void testTaskHandleContainsAutoGeneratedTaskNameWhenTaskNameNotDefinedInTaskOptions() throws Exception {
        Queue queue = QueueFactory.getDefaultQueue();
        TaskHandle handle = queue.add();
        assertNotNull(handle.getName());
    }
View Full Code Here

Examples of com.google.appengine.api.taskqueue.TaskHandle

    }

    @Test
    public void testPullParams() throws Exception {
        final Queue queue = QueueFactory.getQueue("pull-queue");
        TaskHandle th = queue.add(withMethod(PULL).param("foo", "bar").etaMillis(15000));
        sync();
        try {
            List<TaskHandle> handles = queue.leaseTasks(30, TimeUnit.MINUTES, 100);
            assertFalse(handles.isEmpty());
            TaskHandle lh = handles.get(0);
            assertEquals(th.getName(), lh.getName());
        } finally {
            queue.deleteTask(th);
        }
    }
View Full Code Here

Examples of com.google.appengine.api.taskqueue.TaskHandle

    }

    @Test
    public void testPullPayload() throws Exception {
        final Queue queue = QueueFactory.getQueue("pull-queue");
        TaskHandle th = queue.add(withMethod(PULL).payload("foobar".getBytes()).etaMillis(15000));
        sync();
        try {
            List<TaskHandle> handles = queue.leaseTasks(30, TimeUnit.MINUTES, 100);
            assertFalse(handles.isEmpty());
            TaskHandle lh = handles.get(0);
            assertEquals(th.getName(), lh.getName());
        } finally {
            queue.deleteTask(th);
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.