I have a Java class in AEM called "helper", the snippet looks like this:
public class Helper extends Thread{
................
private String glossaryText;
public String getGlossaryText() {
Thread thread = new Thread() {
public void run() {
glossaryText = getGlossaryHTML();
}
};
try {
thread.start();
}
catch(Exception e) {
}finally {
//this does NOT stop the thread
thread.interrupt();
}
System.out.println(thread.isAlive());
return glossaryText;
}
........
}
The problem is that, no matter what i do, System.out.println(thread.isAlive()); always print "true". thread.interrupt(); did not stop the thread.