I am using multithreading and JavaFX to grab the data from a database, so I update the GUI using progress bar. Say for example 10 progress bar for 10 threads. If I have 100,000 records in a database from which I am planning to
pull using 10 threads then I am pulling 1000 records at a time using 10 threads.
My Question is:
1) Is it possible to have a stop button next to 10 progress bars and stop a particular thread if I wish to. As far as I know, once the threads are started in a multithreaded environment, it can't be stopped unless they finish ?
I totally agree. I would just say that the 'manager' thread should try to interrupt (due it maybe in some kind of lock process, f.e.) and also start ignoring the threads as well (not trying to wait all to finish, as it can be and a heavy processes) (or you can create a thread just to take care of this, so you could wait the process, even if the user doesn't want them anymore)