Notification of any String object construction in Java 8 HotSpot VM -


  1. is there way notified on invocations constructor of string class (either directly or using reflection) without weaving or instrumenting rt.jar?

  2. further possible filter these notifications calls within specific package?

  3. further possible make these notifications async (like events) actual jvm invocations not slowed down

my use-case intercept strings being created, make pattern match on content , raise alters based on rules (all in backend) part of platform component.

as don't want instrument rt.jar, aspectj seems out of question (as ltw can't done on java core classes). potential tool seems jvm ti, not sure how achieve it.

thanks, harish

is there way notified on invocations constructor of string class (either directly or using reflection) without weaving or instrumenting rt.jar in compile time?

you not compiling string class, can weaving @ runtime. , yes, way without creating custom jvm.

further possible filter these notifications calls within specific package?

it possible check caller reflection.getcallerclass(n)

further possible make these notifications async (like events) actual jvm invocations not slowed down

all expensive passing work thread.

make pattern match on content

pattern matching expensive compared creating string. if not careful slow down application order of magnitude or two. suggest reconsider real requirements , see if there way trying do.

are sure don't want use profiler this. note: profilers sub-sample e.g. every 10th allocation. there plenty of free ones, in fact 2 come jvm. suggest using flight recorder track allocations has low overhead.


Comments

Popular posts from this blog

javascript - jQuery: Add class depending on URL in the best way -

caching - How to check if a url path exists in the service worker cache -

Redirect to a HTTPS version using .htaccess -