Please find the breif code below..
public class SetUp extends JFrame implements ActionListener,
Runnable {
public static void main(String arg[]) {
//Renders the initial screen..
}
public void actionPerformed(ActionEvent ae) {
if (ae.getSource() == "Execute") {
processCompMig();
}
}
private void processCompMig() {
Thread t = new Thread(this);
t.start();
//Executes the Procedure
t.join();
}
public void run() {
Thread.sleep(1000);
//Constructs text area to display procedure progress
}
}
while executing the method processCompMig() line 3, applet hangs. Even though run() method is getting executed, changes made are not reflected in the applet until the execution returns back to line 4 of processCompMig() method.
I have also tried executing the applet with below given changes
private void processCompMig() {
Thread t1 = new Thread(this,"ExecuteProcedure");
Thread t2 = new Thread(this,"DisplayProgress");
t1.start();
t2.start();
t1.join();
t2.join();
}
public void run() {
string threadName = Thread.getCurrentThread().getName();
if("ExecuteProcedure".equals(threadName)){
//execute Stored Procedure
}
else if(("DisplayProgress".equals(threadName)){
Thread.sleep(1000);
//Constructs text area to display procedure progress
}
}
Even this code did not have any impact while running the applet. It hanged during executing the procedure even in this case.