protected TimerEntity newJobInstance(ExecutionEntity execution) { TimerEntity timer = new TimerEntity(this); if (execution != null) { timer.setExecution(execution); } return timer; }
protected TimerEntity newJobInstance(ExecutionEntity execution) { TimerEntity timer = new TimerEntity(this); if (execution != null) { timer.setExecution(execution); } return timer; }
public void createNewTimerJob(Date dueDate) { // create new timer job TimerEntity newTimer = new TimerEntity(this); newTimer.setDuedate(dueDate); Context .getCommandContext() .getJobManager() .schedule(newTimer); }
public void createNewTimerJob(Date dueDate) { // create new timer job TimerEntity newTimer = new TimerEntity(this); newTimer.setDuedate(dueDate); Context .getCommandContext() .getJobManager() .schedule(newTimer); }
public Void execute(CommandContext commandContext) { JobManager jobManager = commandContext.getJobManager(); timerEntity = new TimerEntity(); timerEntity.setLockOwner(UUID.randomUUID().toString()); timerEntity.setDuedate(new Date()); timerEntity.setRetries(0); StringWriter stringWriter = new StringWriter(); NullPointerException exception = new NullPointerException(); exception.printStackTrace(new PrintWriter(stringWriter)); timerEntity.setExceptionStacktrace(stringWriter.toString()); jobManager.insert(timerEntity); assertNotNull(timerEntity.getId()); return null; } });
protected TimerEntity createTweetTimer(String msg, Date duedate) { TimerEntity timer = new TimerEntity(); timer.setJobHandlerType("tweet"); timer.setJobHandlerConfigurationRaw(msg); timer.setDuedate(duedate); return timer; }
protected void scheduleSuspensionStateUpdate(CommandContext commandContext) { TimerEntity timer = new TimerEntity(); JobHandlerConfiguration jobHandlerConfiguration = getJobHandlerConfiguration(); timer.setDuedate(executionDate); timer.setJobHandlerType(getDelayedExecutionJobHandlerType()); timer.setJobHandlerConfigurationRaw(jobHandlerConfiguration.toCanonicalString()); commandContext.getJobManager().schedule(timer); }
protected void scheduleSuspensionStateUpdate(CommandContext commandContext) { TimerEntity timer = new TimerEntity(); JobHandlerConfiguration jobHandlerConfiguration = getJobHandlerConfiguration(); timer.setDuedate(executionDate); timer.setJobHandlerType(getDelayedExecutionJobHandlerType()); timer.setJobHandlerConfigurationRaw(jobHandlerConfiguration.toCanonicalString()); commandContext.getJobManager().schedule(timer); }
public Void execute(CommandContext commandContext) { JobManager jobManager = commandContext.getJobManager(); timerEntity = new TimerEntity(); timerEntity.setLockOwner(UUID.randomUUID().toString()); timerEntity.setDuedate(new Date()); timerEntity.setRetries(0); timerEntity.setExceptionMessage("I'm supposed to fail"); jobManager.insert(timerEntity); assertNotNull(timerEntity.getId()); return null; } });
protected TimerEntity newJobInstance(ExecutionEntity execution) { TimerEntity timer = new TimerEntity(this); if (execution != null) { timer.setExecution(execution); } return timer; }
@Override public JobEntity mapToEntity(ODocument doc, JobEntity entity, OPersistenceSession session) { if(entity==null) { String type = doc.field("type"); if(TimerEntity.TYPE.equals(type)) entity = new TimerEntity(); else if(MessageEntity.TYPE.equals(type)) entity = new MessageEntity(); } entity = super.mapToEntity(doc, entity, session); String exceptionByteArrayId = doc.field("exceptionByteArrayId"); //JobEntity doesn't allow to set exceptionByteArrayId: so lets inject it. //TODO: Fix this behavior if(exceptionByteArrayId!=null) { try { Field field = JobEntity.class.getDeclaredField("exceptionByteArrayId"); field.setAccessible(true); field.set(entity, exceptionByteArrayId); } catch (Exception e) { logger.warn("Setting exceptionByteArrayId doesn't work", e); } } return entity; }
public void createNewTimerJob(Date dueDate) { // create new timer job TimerEntity newTimer = new TimerEntity(this); newTimer.setDuedate(dueDate); Context .getCommandContext() .getJobManager() .schedule(newTimer); }
protected TimerEntity createTweetTimer(String msg, Date duedate) { TimerEntity timer = new TimerEntity(); timer.setJobHandlerType("tweet"); timer.setJobHandlerConfigurationRaw(msg); timer.setDuedate(duedate); return timer; }
public Void execute(CommandContext commandContext) { JobManager jobManager = commandContext.getJobManager(); timerEntity = new TimerEntity(); timerEntity.setLockOwner(UUID.randomUUID().toString()); timerEntity.setDuedate(new Date()); timerEntity.setRetries(0); StringWriter stringWriter = new StringWriter(); NullPointerException exception = new NullPointerException(); exception.printStackTrace(new PrintWriter(stringWriter)); timerEntity.setExceptionStacktrace(stringWriter.toString()); jobManager.insert(timerEntity); assertNotNull(timerEntity.getId()); return null; } });
protected void scheduleSuspensionStateUpdate(CommandContext commandContext) { TimerEntity timer = new TimerEntity(); JobHandlerConfiguration jobHandlerConfiguration = getJobHandlerConfiguration(); timer.setDuedate(executionDate); timer.setJobHandlerType(getDelayedExecutionJobHandlerType()); timer.setJobHandlerConfigurationRaw(jobHandlerConfiguration.toCanonicalString()); commandContext.getJobManager().schedule(timer); }
public Void execute(CommandContext commandContext) { JobManager jobManager = commandContext.getJobManager(); timerEntity = new TimerEntity(); timerEntity.setLockOwner(UUID.randomUUID().toString()); timerEntity.setDuedate(new Date()); timerEntity.setRetries(0); timerEntity.setExceptionMessage("I'm supposed to fail"); jobManager.insert(timerEntity); assertNotNull(timerEntity.getId()); return null; } });