Currently there are two problems which block successful implementation of late attach functionality in NetBeans Profiler.
1) To be able to determine time spent waiting/sleeping we use NativeMethodBind to intercept Thread.sleep and Object.wait, In the case of late attach, we cannot use NativeMethodBind. We need to be able to instrument native methods (such as mentioned Object.wait and Thread.sleep).
2) RedefineClasses/RetransformClasses doesn't work for classes in the shared archive. When the NetBeans Profiler is started at launch time, class sharing is automatically disabled by the setting of capabilities. In the case of late attach, some classes will be in the shared archive and they can not be instrumented. We need a way how to instrument classes in shared archive.
The shared archive part of this bug should be tracked via the following:
5002268 4/3 Allow class sharing use with RedefineClasses