Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Viveka Fischer   on Oct 02 In Java Category.

  
Question Answered By: Andrew Bryant   on Oct 02

If it is a requirement that we repeatedly process events(not only at start  of application) we can create  a thread that runs at start of application and in a while loop processes events  and then goes to sleep for a while.
Hear is sodo codes:



public Class processor extends Thread{

private sleepTime = 100000;

while(true){

process events(call a stored procedure....);

sleep(sleepTime);

}

}


This thread could be started at a static block and sleepTime could be loaded from a property file.

Share: