Skip to main content
Source Link
Neil
  • 22.9k
  • 48
  • 76

Heh, how interesting. Your problem is how to simulate a less efficient mechanism. I think you can achieve the effect you're looking for by starting a worker thread to fetch the file. Then you simply call waitFor() to make your simulator wait for the return.

To simulate the wait, you could use a timer prior to fetching the file, and once the task is done, check and see if you've already superceded 10 milliseconds. If so, you're done, otherwise, stop the timer and force your application to wait for the remaining time before returning the results.

If you do it right, you should be able to call a method which synchronously fetches file data in no less than 10 milliseconds. Does that help?