Update JProgressBar from ExecutorService
I am pinging gateways using Java ICMP ping function. To perform fast pinging I am using ExectorService which creates threads for pinging. After address is pinged (or not) I want to update Jprogressbar after pinging. I have this code which is working but it updates Jprogressbar before job (ping thread) is finished. I want to update jprogressbar after job is finished. private int NUM_THREADS = Runtime.getRuntime().availableProcessors(); ExecutorService exec = Executors.newFixedThreadPool(NUM_THREADS); public void run() { int JProgressBarValue = 0; for (;GateWayKey<=GateWayKeyStop;GateWayKey++){