You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hello!
In this article I would like to tell you about a way to kill a jvm thread in Atlassian Server products.
Let s first discuss why would we want to kill a jvm thread?
Suppose, you see that Atlassian Jira takes too much cpu. You can not restart Atlassian Jira because it would make your Atlassian Jira unavailable. In this case you can identify the jvm thread which takes most of the cpu time and kill it.
Another example you are developing a program in SIL and you made a loop in your program which will cause your program be active until this program is killed by the SIL engine. This time depends on the TTL parameter in the SIL engine properties but you would like to kill this program now.
To kill a jvm thread you can use Java Melody app.
I will show you how it works.
First, let's develop a program in SIL which will cause an infinite loop. Here is the text of such a program:
while (true) {
string a = "asd";
}
Run this program in the SIL Manager and it will go to an infinite loop.
Now let's try to identify this thread by the Java Melody app. Open your browser in http://yourjirapath/monitoring.
Go to the Threads part and push the + sign:
Now try to identify the thread which runs the SIL program. Here is my thread:
You can see that in the thread stacktrace SIL classes are executed.
Now delete the thread. Push on the circle icon in the last column for the found row.
And the thread is killed which means that the script is not running anymore. In the SIL manager you will see that the script threw an exception:
Now the cpu time is not spend on the infinite loop.
Alexey Matveev
software developer
MagicButtonLabs
Philippines
1,574 accepted answers
1 comment