How to get session Id for a currently executing service

Hi All,

I am trying to get session Id for a flow service.I need to send a JMS message and inthe receiving side I need to get the flow service session Id using which I have to kill the receiving flow service. I tried to get the currently running thread names. But it failed.

Thread currentThread = Thread.currentThread();
//Get all Thread Groups.
ThreadGroup rootThreadGroup = currentThread.getThreadGroup();
//Traverse to the Top Thread Level
while (rootThreadGroup.getParent() != null) {
rootThreadGroup = rootThreadGroup.getParent();
//Getting all Threads
Thread threads = new Thread[1000];
int threadCount = rootThreadGroup.enumerate(threads, true);
String threadList = “”;
// Now traverse through all the Threads and use the ServerThread API from webmethods to get all the thread detail.
int i=0;
for (; i<threadCount ; ++i){
if (threads[i] instanceof {
//Casting a raw thread into ServerThread type serverThread = ( threads[i];
//Getting the service Name for which the thread belongs to
if (serverThread.getState().getService() != null){
threadList = threadList + serverThread.getState().toString() ;
java.util.Stack threadStack = (java.util.Stack) serverThread.getState().getCallStack();
for (Iterator iter=threadStack.iterator(); iter.hasNext():wink: {
Object threadObj =;
threadList = threadList + “\n ” + threadObj.getClass().getName();
threadList = threadList + “, ” + threadObj.toString();
IDataCursor cursor = pipeline.getCursor();
cursor.insertAfter(“threads”, threadList);

This is the code I used to get Thread names.
I am gettig error with methods getService,getCallStack.
If you have any java code to solve this issue kindly share it.

For the compiler messages/error provide the import statements accordingly…

Can you please explain your requirement here… I understand that you are trying to kill a thread (running flow service)

What is your wM version?

Hi There,

Can you tell me what’s your requirement. Though we have option to kill threads from wM8, there is no guarantee that it definitely works. And also its recommended to kill any thread in IS which leads to hangingness of IS.\