Originally posted by Justin Fox: ...or you can just create a thread...
If you're just calling sleep, there's no need to create a new thread object, because the sleep method is static.
Marcus: This sounds like a homework assignment. Can you tell us more about what the requirements are, what you've tried, and where exactly you're stuck? I'm sure we can help you, but we need more information.
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Hey, actually it is part of my final year university project. I am creating an application which allows users to simulate certain communications protocols. This application would allow users to configure networks using network components such as routers and hosts by dragging and dropping images of them onto a configuration area and setting up links between them. I would like to achieve the effect of a propagation delay when data is sent along links between the nodes. I tried using the java.util.Timer class along with the java.util.TimerTask class, but I am getting problems because of thread synchronization issues(i concluded this, I could be wrong). I found a class online, timer_engine, which is a virtual timer and right now i am trying to incorporate it into my system. Below is a thread I was trying to write to do the propagation delay.
Bascially, i have a class called Link, which has a vector called Data which stores the DataUnit objects being sent and routed by Host and Routerobjects. The above thread is first checking to see whether the vector is empty. That is the problem i am having; although i am doing this check before I do anything to the vector, i am still getting this exception: java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 0 I don't know if i have explained myself well enough, so i will stop here and wait for your feedback. Thanks!!!