I have a generic public class containing a Vector that implements Runnable. I
then have a subclassed singleton that I getInstance() in a jsp page to make
sure that the browser clients are all using the same Vector.
I want to add an element to the Vector every 4 seconds using Thread.sleep(). I
am trying to access this Vector in a jsp page by reloading the browser every 4
seconds. The page is supposed to display the contents of the Vector. The
generic class' run method is posted below.
when I run this method the jsp page seems to be eternally hung. without the
synchronized{} statement the Vector would get updated once and that would be
all.
public void run(){
runThread = true;
try{
synchronized(this) {
while(runThread){
Thread.sleep(4000);
imageURLs.addElement("barley");
notifyAll();
}
}
} catch (Exception e){ }
}
Anyone know why it doesn't seem to work?
-thanx
Ryan
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, email: [EMAIL PROTECTED]