The Artima Developer Community
Sponsored Link

Java Answers Forum
Question about thread simulation

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Ryan

Posts: 1
Nickname: gramberto
Registered: Apr, 2003

Question about thread simulation Posted: Apr 23, 2003 3:43 PM
Reply to this message Reply
Advertisement
I want to set up a queue that can feed into 3 seperate threads. Each thread is pretty much identical. For example each thread will run for say 1 minute. When an entity 'enters' the thread no other entity can enter for 10 seconds(Im just making numbers up... so I want it to be generic).

I know to use synchronize, wait, and notify, but Im struggling with the design.

I have a controller class that contains my queue of entities. It then has to place the entities in the proper thread.

How do I do the delay? I understand the consumer producer, but this has two more requirements.

1. There is a delay before an item can be consumed.
2. After it is consumed, it has to move to another timer.



class myThread extends thread{
mythread(){}
synchronized start()(
starts a timer that lasts 10 seconds.
notify()
}
continue(){
lasts 50 seconds
sets boolean flag when complete
}

}

Topic: balanced parenthesis function Previous Topic   Next Topic Topic: converting a  char to a String

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use