private void update(int i, int sleepTime) {
   // Now we do the job requested by the app client.
   //  called with: record.getPosIndex() == endOfCycle
   //  where endOfCycle = maxPosIndex for forward and 0 for reverse
   aRecord = dbManager.getRecord(i);
   //  Reset the posIndex
   aRecord.setPosIndex(0); // depending on direction
   // increment the colour index
   aRecord.incColorIndex();
   if (aRecord.getColorIndex() == aStatus.getMaxColorIndex()) {
     // also may depend on app
     // if all colours done, start again
     aRecord.setColorIndex(0);
     // if ((record).incCount|2 == 0){
     // (record).setDirection(true)}
     // else (record).setDirection(false);
   }
   try {
     Thread.sleep(sleepTime);
   } catch (InterruptedException e) {
     System.out.println("Interrupted sleep");
   }
   dbManager.setRecord(i, aRecord);
   System.out.println("appServer cycleEnded: " + i);
 }
 public void makeSetup(int i) {
   // make aStatus
   aStatus.makeStatus(i, sysMode);
   // make runningRecord
   aRecord.setRecord(i);
 }