1

What i have completed:

  1. upload it to server
  2. download from server

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.

SDR
  • 45
  • 9

3 Answers3

2

Looks like a typical Producer/Consumer Synchronization Problem:

You can use a flag or you can use a observable/observer pattern to synchronize this.

Nargis
  • 4,687
  • 1
  • 28
  • 45
0

You could set a Thread.wait() on each Thread. After you have finished a Thread call notify() to release and start working

JavaDM
  • 851
  • 1
  • 6
  • 29
0

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:

Community
  • 1
  • 1
GrahamA
  • 5,875
  • 29
  • 39