Determining the order of java classes called

I thought this was pretty interesting, and perhaps incredibly useful. While attempting to understand the call stack (and being too lazy to read through reams of source code), I found that calling a java class will result in stat() system calls to find each class in the tree. These result in a “No such file or directory” exception, but it provides you with each class called, as well as the order in which it was called. It may not find them, but the only reason it is requested is because the current class attempted to create an instance of the given class that was next in the call tree.

[root@cmhlpdlkedat15 ~]# strace -f -e trace=\!futex -tt -s 512 java hbaseStresser 1 2>&1 | grep class | cut -f2 -d'"' | sed -e 's/\/root\///g' | grep class$
hbaseStresser.class
hbaseStresser.class
hbaseStresser.class
org/apache/hadoop/hbase/HBaseConfiguration.class
org/apache/hadoop/conf/Configuration.class
org/apache/hadoop/io/Writable.class
org/apache/hadoop/fs/FileSystem.class
org/apache/hadoop/conf/Configured.class
org/apache/hadoop/conf/Configurable.class
org/apache/hadoop/fs/LocalFileSystem.class
org/apache/hadoop/fs/ChecksumFileSystem.class
org/apache/hadoop/fs/FilterFileSystem.class
org/apache/commons/logging/LogFactory.class
org/apache/commons/logging/LogConfigurationException.class
org/apache/commons/logging/LogFactory$6.class
org/apache/commons/logging/impl/WeakHashtable.class
org/apache/commons/logging/LogFactory$1.class



com/google/protobuf/ProtocolMessageEnum.class
com/google/protobuf/Internal$EnumLite.class
com/google/protobuf/Internal$EnumLiteMap.class

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.