java - Compare Same Function Output in different moments -


i've trouble comparison between same function output in different moments.

public int get_csv_number_lane() {    return csvfile.numberlane(); //this func return number of lane in csv file } 

in main form want save value , open thread. thread checks if (old saved value != new value){do something}

int number_of_lane = get_csv_number_lane();  thread() {     if(number_of_lane != get_csv_number_lane())     {        println("number of lane changes");        number_of_lane = get_csv_number_lane();     } } 

i have function return line of csv file. during execution file can change. have thread checks if old value (line of cvs @ start) different new value (line of csv now) , something. problem check: old value new value.

my question is, how can fix that, how can store old value , check new one?

if familiar executorservice, can use similar type of - scheduledexecutorservice: an executorservice can schedule commands run after given delay, or execute periodically. scheduledexecutorservice can start 1 thread check periodically value , can compare old value. here tutorial how use scheduledexecutorservice


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -