Esempio n. 1
0
 private ThreadReference findThread(String idToken) throws NoSessionException {
   String id;
   ThreadReference thread = null;
   if (idToken.startsWith("t@")) {
     id = idToken.substring(2);
   } else {
     id = idToken;
   }
   try {
     ThreadReference[] threads = threads();
     long threadID = Long.parseLong(id, 16);
     for (ThreadReference thread2 : threads) {
       if (thread2.uniqueID() == threadID) {
         thread = thread2;
         break;
       }
     }
     if (thread == null) {
       // env.failure("No thread for id \"" + idToken + "\"");
       env.failure("\"" + idToken + "\" is not a valid thread id.");
     }
   } catch (NumberFormatException e) {
     env.error("Thread id \"" + idToken + "\" is ill-formed.");
     thread = null;
   }
   return thread;
 }
Esempio n. 2
0
 private static String threadName(ThreadReference threadReference) {
   return threadReference.name() + "@" + threadReference.uniqueID();
 }