multithreading - How can I copy/clone a single row from a ResultSet in Java? Multithread implementation -


i retrieve resultset lot of rows. each row has analyzed, i'd analyze each row in new thread (don't worry: won't start threads simultaneously, let 10 in row). entire resultset used exclusively read data (so, it's kind of static read-only table).

so i'd is:

resultset rs;  public void loadresultset(){      ...     rs = _preparedstatement.executequery();      int rowsize = 0;      while (rs.next()) {        rowsize++;     }       //this method starts 10 threads simultaneously     runthreads(rowsize);       ...  } 

and...

@override public void run() {       //unknown object allows me store copy of single row resultset     foo foo = rs.absolute(index);      //then can retrieve data normal resultset     string s = foo.getstring(1);      ....     ....  }  

any suggestion?

samples appreciated! thanks!

if u, rather execute queries in separate threads like:

select * table_name mod(id,threadcount)=threadid

just give id each thread , execute them. this, each thread have different datas process


Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -