...
After that the classes are initialized (static and as needed) and are executed.
When all non-daemon threads are done, the application terminates.
Method Invocations
Instrumentation
Classes are instrumented by using the Java Agent interface. Only static instrumentation is used by InspectIT( with the preMain() method).
There is no need to instrument classes with the class loader method anymore.
Threads
No thread object is created and started until the method start() is called. That means, that there is no concurrency involved.
Three points of interest are essential on threads:
- Which thread created a the thread
- Which one starts it
- Which thread executes it
Example scenario:
Thread1- Creates
Thread2- Initializes
Thread3- Calls the Runnable from a queue
Thread4- Executes it
Its important to keep the principle of thread pools in mind. Its commonly used by web applications.
It allows the reuse of threads, which means there is no need to create new thread instances. This reduces overhead, since the system don't have to manage new threads(no new memory allocation etc.).