C
Crouchez
Is there anyway to get the number of threads running in JVM through the java
api?
api?
Crouchez said:Is there anyway to get the number of threads running in JVM through the java
api?
Crouchez said:Is there anyway to get the number of threads running in JVM through the java
api?
Arne Vajhøj said:Crouchez said:Is there anyway to get the number of threads running in JVM through the
java api?
Try:
ThreadGroup tg = Thread.currentThread().getThreadGroup();
while(tg.getParent() != null) {
tg = tg.getParent();
}
Thread[] t = new Thread[tg.activeCount()];
tg.enumerate(t);
Arne
Knute Johnson said:Not that I know of but why would you care?
Crouchez said:Arne Vajhøj said:Try:Crouchez said:Is there anyway to get the number of threads running in JVM through the
java api?
ThreadGroup tg = Thread.currentThread().getThreadGroup();
while(tg.getParent() != null) {
tg = tg.getParent();
}
Thread[] t = new Thread[tg.activeCount()];
tg.enumerate(t);
have you tried that?
Crouchez said:cos i want to monitor and cull if i need to
Is there anyway to get the number of threads running in JVM through the java
api?
Roedy Green said:isn't there some command you can issue to the Java console to get a
thread dump?
you can use Thread.getAllStackTraces().size() for thatCrouchez said:Is there anyway to get the number of threads running in JVM through the java
api?
Crouchez said:just out of interest how does swing run gui interaction - through events -
but are these threads?
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.