private synchronized void checkIfSuspended() { if (suspended) { try { wait(); // suspends the thread } catch (InterruptedException e) { System.out.println(e.toString()); } } }