java - ProgressBar and multithreading javafx -


i have applications search page , specified number of links. each link retrieved separate thread. simple code this:

    public class getlinkthread implements runnable {     public int page;     public getlinkthread(int page) {         this.page = page;     }     @override     public void run() {         try {             parser.parseandaddlinktoset(page);//this method links sites , save set         } catch (ioexception e) {             e.printstacktrace();         }     } } 

in parseandaddlinktoset(int page) method string root = "www.example.com/" + page; send page number crawled links.

and run this:

executorservice executorservice = executors.newcachedthreadpool();     for(int = 1 ; < 4 ; i++){//in case run 3 threads         executorservice.execute(new getlinkthread(i));     }     executorservice.shutdown();     executorservice.awaittermination(1, timeunit.hours); 

i want make progressbar when downloading links show link being downloaded given thread. can make progressbar don't know how make progressbar run in background , threads.

so question is, how can add progressbar application? progressbar running when crawling page , display current page?


Comments

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -