public void run() { // set first data sif.setData(); // start recording max sif.recordMax(true, sif); // continue setting sensor data while sensor is still active while (!sif.getIsShutdown()) { Thread.Sleep(timeout); sif.setData(); } // if sensor is shut down, shut down threads sif.shutdown(true); }