dcsimg
Timer and Thread
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Pradana_Adrinusa
Posted On:   Monday, July 30, 2001 02:37 PM

Hi all,

I hope someone would give me some advices regarding
using Timer and Thread.

This is my situation.
I would like to develop a Java program :
1) which check every one minute if a file exist within a directory
2) if exist, then process it ( this may time-comsuming )

I think to implement the point 1) I use a Timer, and the second one
the Thread.

Is this the correct approach ?
Any comment would be appreciate.

Thanks,
nusa.

Re: Timer and Thread

Posted By:   Kevin_Riff  
Posted On:   Tuesday, July 31, 2001 02:19 PM

Sounds like a reasonable design.



You could also drop the timer and simply use a thread. Your thread would check the file and, if necessary, process it. Then your thread enters a sleeping state for one minute. Use a loop so that when the thread wakes up, it checks the file again.

About | Sitemap | Contact