SDR
SDR

Reputation: 45

Running java program one after the other

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.

Upvotes: 1

Views: 163

Answers (3)

Nargis
Nargis

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

GrahamA
GrahamA

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

JavaDM
JavaDM

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

Related Questions