Examples of TaskHandle


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

        if (url != null){
          URL uri = url.toURL();
          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 org.b3log.latke.taskqueue.TaskHandle

                        taskOptions.method(TaskOptions.Method.GET);
                        break;
                }

                final com.google.appengine.api.taskqueue.TaskHandle handle = queue.add(taskOptions);
                final TaskHandle ret = new GAETaskHandle(handle);

                return ret;
            }
        };
    }
View Full Code Here

Examples of pt.ul.armus.edgebuffer.TaskHandle

   * @see pt.ul.jarmus.JArmusFacade#afterTask()
   */
  @Override
  public void afterTask() {
    ResourceManager task = resourceManager.get();
    TaskHandle oldTask = task.endTask();
    verifier.getBuffer().destroy(oldTask);
  }
View Full Code Here

Examples of pt.ul.armus.edgebuffer.TaskHandle

   * Finish the context. This should be called after the task executes a task.
   * @return
   */
  public TaskHandle endTask() {
    // discard current state and revert to the previous state
    TaskHandle oldHandle = handle;
    State state = stack.pop();
    this.phases = state.res;
    this.handle = state.handle;
    return oldHandle;
  }
View Full Code Here

Examples of pt.ul.armus.edgebuffer.TaskHandle

    ver = new JArmusControllerImpl(strat);   
  }

  @Test
  public void threadRegisteredPhase1() throws InstantiationException, IllegalAccessException {
    TaskHandle task = mock(TaskHandle.class);
    EdgeBuffer buffer = mock(EdgeBuffer.class);
    when(strat.getBuffer()).thenReturn(buffer);
    when(buffer.createHandle()).thenReturn(task);
    assertEquals(1, ver.getPhase(Thread.currentThread()));
  }
View Full Code Here

Examples of pt.ul.armus.edgebuffer.TaskHandle

    assertEquals(1, ver.getPhase(Thread.currentThread()));
  }

  @Test
  public void ensureThreadIsRegistered() throws InstantiationException, IllegalAccessException {
    TaskHandle task = mock(TaskHandle.class);
    EdgeBuffer buffer = mock(EdgeBuffer.class);
    when(strat.getBuffer()).thenReturn(buffer);
    when(buffer.createHandle()).thenReturn(task);
    ver.ensureRegistered(Thread.currentThread());
  }
View Full Code Here

Examples of pt.ul.armus.edgebuffer.TaskHandle

    ver.ensureRegistered(Thread.currentThread());
  }

  @Test
  public void testThreadIsRegistered() throws InstantiationException, IllegalAccessException {
    TaskHandle task = mock(TaskHandle.class);
    EdgeBuffer buffer = mock(EdgeBuffer.class);
    when(strat.getBuffer()).thenReturn(buffer);
    when(buffer.createHandle()).thenReturn(task);
    assertTrue(ver.isRegistered(Thread.currentThread()));
  }
View Full Code Here

Examples of pt.ul.armus.edgebuffer.TaskHandle

    assertTrue(ver.isRegistered(Thread.currentThread()));
  }
 
  @Test
  public void testThreadIsRegisteredBeginTask() throws InstantiationException, IllegalAccessException {
    TaskHandle task = mock(TaskHandle.class);
    EdgeBuffer buffer = mock(EdgeBuffer.class);
    when(strat.getBuffer()).thenReturn(buffer);
    when(buffer.createHandle()).thenReturn(task);
   
    ver.beforeTask();
View Full Code Here

Examples of pt.ul.armus.edgebuffer.TaskHandle

public class ResourceManagerTest {
  private static final Object synch = new Object();
 
  @Test
  public void testIsRegistered() {
    TaskHandle handle = mock(TaskHandle.class);
    ResourceManager m = new ResourceManager(handle);
    m.register(synch, 0);
    assertTrue(m.isRegistered(synch));
  }
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.