Gemini Pai

Greenhorn
+ Follow
since Apr 20, 2009
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Gemini Pai

Yes I do understand what Thread.join is doing..but in the mean time applet hangs. Is there any way to avoid applet hanging such that I can view the applet...
14 years ago
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.
14 years ago
As mentioned in my initial posting..I am tryig to run a applet which has to execute a Stored procedure and simultaneously show a status message.
As specified by you i have tried executing the Procedure in different thread. but even that did not stop applet from hanging. Due to which the status message constructed is not getting rendered while executing the procedure.

Is there any solution to avoid applet hanging during procedure execution..??
14 years ago
Currently yes its running in the same thread..But I have tried it with different thread as well...Even that was of no use..I have even tried rendering the status message using internal pane and pop up..but since the whole applet is blanked out none of these were usefull..
14 years ago
Main thread of my applet is executing a Stored procedure. A child thread is running simultaneously trying to show status of the procedure execution.

But since the procedure is very expensive applet completely hangs (Blanks out..) and hence the status text area constructed by child thread is not getting rendered untill the procedure execution is completed and control returns to the applet.

Is there any way to avoid applet getting hanged in this situation..any help in this regard will be great.
Thanks in advance.
14 years ago