Skip to content
Advertisement

Tag: sleep

Implement the `sleep()` and `awake()` in java

I need to develop the sleep() and awake() functions of the OS. I have runningJobs queue, and sleepingJobs queue. The sleep method should receive a Job and insert it in the sleeping queue in the right place, and the awake() method should move the sleeping jobs that are ready to run, to the runningJobs queue. In not sure how to

How do I make a delay in Java?

I am trying to do something in Java and I need something to wait / delay for an amount of seconds in a while loop. I want to build a step sequencer. How do I make a delay in Java? Answer If you want to pause then use java.util.concurrent.TimeUnit: To sleep for one second or To sleep for a minute.

Java Thread Sleep and Interrupted Exception

Why does a sleep thread need a try catch to catch Interrupted Exception? Why does a sleep even emit an Interrupted Exception error? This are the two questions I really wanna find out about in java programming I’ve been searching through google and i’ve still haven’t found a clear explanation is to why this two things happen. Answer Because a

Advertisement