dcsimg
run method
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   trupti_nigam
Posted On:   Monday, August 30, 2004 02:36 PM

Hello all, My program needs to query the DataBase every couple of seconds and get the value of one paricular column from the Db. Depending on the value (result) I have a switch case statement. I am thinking about using Timer and timerTask. but my question can the run method in the timerTask return the value queried from the Db?? here is the very basic code to get an idea what i am trying to do.. public class VoidETCarrierAction extends VoidConfirmAction { long delay = 1000*2;//(2 seconds) Timer timer = new Timer(); TimerTask voidETCarrierTask = new voidETCarrierTask(); timer.schedule(v   More>>


Hello all,

My program needs to query the DataBase every couple of seconds and get the value of one paricular column from the Db.
Depending on the value (result) I have a switch case statement.

I am thinking about using Timer and timerTask. but my question can the run method in the timerTask return the value queried from the Db??

here is the very basic code to get an idea what i am trying to do..


public class VoidETCarrierAction extends VoidConfirmAction


{


long delay = 1000*2;//(2 seconds)


Timer timer = new Timer();


TimerTask voidETCarrierTask = new voidETCarrierTask();


timer.schedule(voidETCarrierTask,delay);


//if carrier_void_status <> waiting


// get carrier_void_result


//case(result)


//result:error


//result:confirm ,travelDocDAO.unlockDoc(dcNbr,docSeqNbr)


//return to user the listPage


}


class voidETCarrierTask extends TimerTask


{


TimerTask voidETCarrierTask = new voidETCarrierTask();


public void run()


{


//every Couple of seconds


//1. select database_row_locking to check


carrier_void_result


}



}


can someone please let me know how to implement it??

thanks,
Trupti

   <<Less

Re: run method

Posted By:   Edward_Harned  
Posted On:   Monday, August 30, 2004 04:54 PM

I can't make any sense out of your code.




Forget timer. Put a sleep(2000) in a loop where you get the db value




loop

    Thread.sleep(2000);

    int value = x.getDB;

    switch (value){

About | Sitemap | Contact