Reputation: 45
What i have completed:
download should happen only if upload is done. I have the code to do it as separate java classes. What i need to do is.
For every hour upload should be done in the 1st half hour and only if upload is done , in the next 1/2 hour download should be done.and again after download upload should be done.
Upvotes: 1
Views: 163
Reputation: 4787
Looks like a typical Producer/Consumer Synchronization Problem:
You can use a flag or you can use a observable/observer pattern to synchronize this.
Upvotes: 2
Reputation: 5923
If you are working with files take a look at this answer, you may be be able to use JNotify to listen to file system events, such as:
Upvotes: 0
Reputation: 851
You could set a Thread.wait()
on each Thread. After you have finished a Thread call notify()
to release and start working
Upvotes: 0