Thread is hanging up
HI all,
I am seeing a strange behaviour, I dont know what the problem is ,
I am new to thread world.
I have written a simple java program.
One thread will be periodically running and calling another thread to perform an action based on some condition.. In the below code, whenever the Inner thread calls start method in perform method, it will hang up at that time, It should come once it triggers the another thread. But in rare cases, the caller thread hangs up,
This is not frequent, once in a while it happens,
Could anybody tell what could be reason for one thread to be in RUNNNING state and hanging at some point in the code (at start method of the another thread). and never come out again.
The code is below,
Thanks,
Sheetal,
In the below, code,
The inner thread goes to method(), and to perform method, and hangs out at start() (Line number 29), Count anybody tell the reason.
1 class Inner extends Thread {
2run() {
3 Thread.sleep(20000);
4 try{
5 if (something)
6 mehod();
7 } catch (Exception e){
8}
9}
10
11method(){
12performAction pa = new performAction();
13pa.perform()';
14}
15
16class performAction {
17
18perform{}{
19
20Thread e = new Thread(){ new Runnuable(){
21public void run() {
22try {
23// Do Some actions,
24} catch(Exceptione ){
25};
26
27 }
28}
29e.start);
30 }

