Examples of Wake


Examples of net.ex337.scriptus.model.scheduler.Wake

    ScriptusDatastore datastore = (ScriptusDatastore) appContext.getBean("datastore");
   
    Calendar then = Calendar.getInstance();
    then.add(Calendar.HOUR, 3);
   
    Wake w = new Wake(UUID.randomUUID(), 1234, then.getTimeInMillis());
   
    datastore.saveScheduledTask(w);
   
    List<ScheduledScriptAction> actions = datastore.getScheduledTasks(Calendar.getInstance());
   
    assertFalse("doesnt contain task in future", actions.contains(w));
   
    actions = datastore.getScheduledTasks(then);
   
    assertTrue("contains task in future",  actions.contains(w));
   
    boolean found = false;
   
    Wake neww = null;
   
    for(ScheduledScriptAction t : actions){
      if(t.equals(w)) {
        neww = (Wake) t;
        found = true;
        break;
      }
    }
   
    assertTrue("retrieved task", found);
   
    then.add(Calendar.HOUR, 1);
   
    actions = datastore.getScheduledTasks(then);
   
    assertTrue("list not empty",  ! actions.isEmpty());
   
    found = false;
   
    for(ScheduledScriptAction t : actions){
      if(t.equals(w)) {
        found = true;
        break;
      }
    }
   
    datastore.deleteScheduledTask(neww.getPid(), neww.getNonce());

    actions = datastore.getScheduledTasks(then);
   
    found = false;
   
View Full Code Here

Examples of net.ex337.scriptus.model.scheduler.Wake

  @Override
  public void visit(final ScriptusFacade scriptus, final ScriptProcess process) {
   
        scriptus.updateProcessState(process.getPid(), this);
       
      scriptus.scheduleTask(new Wake(process.getPid(), nonce, until.getTimeInMillis()));
   
   
  }
View Full Code Here

Examples of net.ex337.scriptus.model.scheduler.Wake

  @Override
  public void visit(final ScriptusFacade scriptus, final ScriptProcess process) {

    scriptus.updateProcessState(process.getPid(), this);

    scriptus.scheduleTask(new Wake(process.getPid(), nonce, timeout.getTimeInMillis()));

    String messageId = scriptus.send(process.getUserId(), process.getTransport(), getWho(), getMsg());
   
        scriptus.registerMessageCorrelation(new MessageCorrelation(process.getPid(), getWho(), messageId, System.currentTimeMillis(), process.getTransport(), process.getUserId()));
   
View Full Code Here

Examples of net.ex337.scriptus.model.scheduler.Wake

    @Override
    @Transactional(readOnly = false)
    public void saveScheduledTask(ScheduledScriptAction task) {
        if (task instanceof Wake) {
            Wake w = (Wake) task;

            ScheduledScriptActionDAO d = new ScheduledScriptActionDAO();
            d.action = "wake";
            d.nonce = w.getNonce();
            d.pid = w.getPid().toString();
            d.when = task.getWhen();

            em.persist(d);

        } else {
View Full Code Here

Examples of net.ex337.scriptus.model.scheduler.Wake

    private ScheduledScriptAction toScheduledAction(ScheduledScriptActionDAO dao) {
        ScheduledScriptAction r = null;

        if (dao.action.equalsIgnoreCase("wake")) {
            Wake w = new Wake(UUID.fromString(dao.pid), dao.nonce, dao.when);
            r = w;
        } else {
            throw new ScriptusRuntimeException("unkown type of action " + dao.action);
        }
View Full Code Here

Examples of net.ex337.scriptus.model.scheduler.Wake

  @Override
  public void visit(final ScriptusFacade scriptus, final ScriptProcess process) {

    scriptus.updateProcessState(process.getPid(), this);

    scriptus.scheduleTask(new Wake(process.getPid(), nonce, timeout.getTimeInMillis()));
   
    //who and messageId can both be null
        scriptus.registerMessageCorrelation(new MessageCorrelation(process.getPid(), getWho(), getMessageId(), System.currentTimeMillis(), process.getTransport(), process.getUserId()));

   
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.