WorkerThread.java - Source code of artefact used in the examples in this tutorial
Given below is the source code of WorkerThread.java which is used in the examples in previous pages on Simon.
package com.techfundaes.simonBag; import org.javasimon.SimonManager; import org.javasimon.Split; import org.javasimon.Stopwatch; public class WorkerThread extends Thread { Stopwatch stopwatch = SimonManager.getStopwatch("use.multiThreaded"); Split split = null; @Override public void run() { for(int i = 0; i < 5; i++) { split = stopwatch.start(); doVitalTask(); split.stop(); } } private static void doVitalTask() { try { Thread.sleep(100); } catch (Exception e) { e.printStackTrace(); } } }