@Override public void run() { Random r = new Random(); VoodooSequence = r.nextDouble(); initWelder(); while (true) { UpdateWelderValues ssv = new UpdateWelderValues(main, this); ssv.schedule(); SendWeldingDatapointsCommand cmd = new SendWeldingDatapointsCommand(main, this); cmd.schedule(); if (r.nextFloat() < 0.05) { // send a "test alarm" Alarm a = new Alarm(); a.setType(AlarmTypes.CHEESEBURGER_DROPPED); a.setErrorMessage("Someone dropped a cheeseburger on the circut board."); SendAlarmCommand sac = new SendAlarmCommand(main, a); sac.schedule(); } try { Thread.sleep((long) (r.nextFloat() * 10000)); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } int queuesize = XMPCommandRunner.getQueueSize(); if (queuesize > 100) { // maybe send alarm here? or will that clog up the queue even more? } } }
public void schedule() { XMPCommandRunner.scheduleCommand(this); }