Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Thread-Id auslesen

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich bin auf der Suche nach einem Äquvialent der erst in Version 1.5 eingeführten Methode Thread.getId() die in Java 1.3.1 u. 1.4.2 lauffähig ist.

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Thread.html#getId()

Danke im vorraus

ich möchte die aktuell laufenden threads abfragen, die ich nicht während der laufzeit erzeugt habe.

Es geht um Threads die Auf einem EJB Server laufen, durch viele versch. Clients angestoßen

hm also ich bin bis jetzt auf noch keinen grünen Zweig gekommen, aber gut versuchen wir einen anderen weg.

Kennt jemand eine Möglichkeit, den "parent" eines Prozesses (Threads) "auszulesen"?

ich hab dazu jetzt folgendes gefunden:

/**

 * ThreadGroupTree.java

 * Copyright (c) 2003 by Dr. Herong Yang

 */

class ThreadGroupTree {

   public static void main(String[] args) {

      Thread t = Thread.currentThread();

      ThreadGroup g = t.getThreadGroup();

      g = g.getParent();

      printInfo(g,"");

      g.list();

   }

   public static void printInfo(ThreadGroup g, String p) {

      System.out.println(p+"ThreadGroup name = "+g.getName());

      System.out.println(p+"   Has parent thread group = "

         +(g.getParent()!=null));

      int n = g.activeCount();

      System.out.println(p+"   # of active threads = "+n);

      Thread[] l = new Thread[n];

      n = g.enumerate(l, false);

      for (int i=0; i<n; i++) {

         System.out.println(p+"   Thread name = "+l[i].getName());

      }  

      n = g.activeGroupCount();

      System.out.println(p+"   # of active sub thread groups = "+n);

      ThreadGroup[] s = new ThreadGroup[n];

      n = g.enumerate(s, false);

      for (int i=0; i<n; i++) {

         printInfo(s[i],"   "+p);

      }  

   }   

}

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.