Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #32881
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2015-10-14 10:04 -0700 |
| References | <97d86c97-b889-44a1-931f-20b5af9c6ab5@googlegroups.com> <3f0fbfa8-66a0-4aa3-b9c3-b83dcc29d259@googlegroups.com> |
| Message-ID | <0fec1882-4b73-468a-804e-6364703f8932@googlegroups.com> (permalink) |
| Subject | Re: The code being executed before hitting main() method |
| From | John <xsli2@yahoo.com> |
This is my Java class:
public class Hello {
public static void main(final String[] args){
final String str = "Hello World";
System.out.println(str);
System.out.println("No. of active thread: " + Thread.activeCount());
try {
Thread.sleep(4000000); //let the 'java' process run for long time so i can run command 'jstack'
}
catch(final Exception e){
System.out.println(e);
}
}
}
Run:
java Hello &
Then by running 'ps' command, I found the process id of 'java' -- which is 2554 on my hand, then run:
$jstack 2554
2015-10-14 11:27:55
Full thread dump Java HotSpot(TM) Server VM (24.71-b01 mixed mode):
"Attach Listener" daemon prio=10 tid=0x6c100800 nid=0xb05 waiting on condition [0x00000000]
java.lang.Thread.State: RUNNABLE
"Service Thread" daemon prio=10 tid=0x6c68a400 nid=0xa0b runnable [0x00000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread1" daemon prio=10 tid=0x6c688800 nid=0xa0a waiting on condition [0x00000000]
java.lang.Thread.State: RUNNABLE
"C2 CompilerThread0" daemon prio=10 tid=0x6c686800 nid=0xa09 waiting on condition [0x00000000]
java.lang.Thread.State: RUNNABLE
"Signal Dispatcher" daemon prio=10 tid=0x6c684c00 nid=0xa07 runnable [0x00000000]
java.lang.Thread.State: RUNNABLE
"Finalizer" daemon prio=10 tid=0x6c674800 nid=0xa06 in Object.wait() [0x6fb7d000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x9efc4240> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
- locked <0x9efc4240> (a java.lang.ref.ReferenceQueue$Lock)
at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:151)
at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:209)
"Reference Handler" daemon prio=10 tid=0x6c673000 nid=0xa05 in Object.wait() [0x6fd7d000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait(Native Method)
- waiting on <0x9efc3ed8> (a java.lang.ref.Reference$Lock)
at java.lang.Object.wait(Object.java:503)
at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:133)
- locked <0x9efc3ed8> (a java.lang.ref.Reference$Lock)
"main" prio=10 tid=0xb7607400 nid=0x9fb waiting on condition [0xb7752000]
java.lang.Thread.State: TIMED_WAITING (sleeping)
at java.lang.Thread.sleep(Native Method)
at temp.Hello.main(Hello.java:16)
"VM Thread" prio=10 tid=0x6c670800 nid=0xa04 runnable
"GC task thread#0 (ParallelGC)" prio=10 tid=0xb7611400 nid=0x9fc runnable
"GC task thread#1 (ParallelGC)" prio=10 tid=0xb7612800 nid=0x9fd runnable
"GC task thread#2 (ParallelGC)" prio=10 tid=0xb7614000 nid=0x9fe runnable
"GC task thread#3 (ParallelGC)" prio=10 tid=0xb7615800 nid=0x9ff runnable
"GC task thread#4 (ParallelGC)" prio=10 tid=0xb7617000 nid=0xa00 runnable
"GC task thread#5 (ParallelGC)" prio=10 tid=0xb7618400 nid=0xa01 runnable
"GC task thread#6 (ParallelGC)" prio=10 tid=0xb7619c00 nid=0xa02 runnable
"GC task thread#7 (ParallelGC)" prio=10 tid=0xb761b400 nid=0xa03 runnable
"VM Periodic Task Thread" prio=10 tid=0x6c68c400 nid=0xa0c waiting on condition
JNI global references: 106
Wow, so many threads! So many garbage collection threads for such a simple program! I am even wondering if the 'java' on this RedHat Linux needs to be configured.
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
The code being executed before hitting main() method John <xsli2@yahoo.com> - 2015-10-14 06:26 -0700
Re: The code being executed before hitting main() method Eric Douglas <e.d.programmer@gmail.com> - 2015-10-14 06:51 -0700
Re: The code being executed before hitting main() method Thomas Richter <thor@math.tu-berlin.de> - 2015-10-14 16:31 +0200
Re: The code being executed before hitting main() method Eric Douglas <e.d.programmer@gmail.com> - 2015-10-14 08:54 -0700
Re: The code being executed before hitting main() method Thomas Richter <thor@math.tu-berlin.de> - 2015-10-14 18:04 +0200
Re: The code being executed before hitting main() method j4n bur53 <janburse@fastmail.fm> - 2015-10-14 18:49 +0200
Re: The code being executed before hitting main() method John <xsli2@yahoo.com> - 2015-10-14 08:19 -0700
Re: The code being executed before hitting main() method John <xsli2@yahoo.com> - 2015-10-14 10:04 -0700
Re: The code being executed before hitting main() method j4n bur53 <janburse@fastmail.fm> - 2015-10-14 19:08 +0200
csiph-web