Open hangshao0 opened 8 months ago
FYI @vijaysun-omr
Thanks, Hang. This would have been great to have in an investigation we were engaged in over the past month for measuring InstantOn startup with different SCC contents. I look forward to when this item is implemented.
Currently there is no command line option that could prevent specific classes from being stored into and returned from the shared class cache. For diagnostic purpose, it is helpful to allow users to exclude certain classes from SCC by specifying the class name.
OpenJ9 provided an interface SharedClassFilter. User can implement this filter to control which classes are found and stored in the shared cache. Note that
SharedClassFilter
affects class sharing through packagecom.ibm.oti.shared
, so it has no effect on bootstrap classes and annon classes. TheSharedClassFilter
requires the user to put the implemented filter class into the class path of the application, which might not always be possible. It is more desirable that user can specify the unwanted classes by name through the command line option.The command line option can be sth like
-Xshareclasses:exclude=<class_specification>[,<class_specification>]
The syntax for<class_specification>
is:{[!][*][<package>/]<class>[*]}
.User can pass in more than one class specifications. User can use an asterisk (*) as a wildcard. User can use an exclamation point (!) before the specification to mean "everything except this".
Examples are:
-Xshareclasses:exclude={java/util/HashMap}
------ excludeHashMap
from sharing-Xshareclasses:exclude={java/io/*,java/net/*}
----- exclude packagesjava/io
andjava/net
from sharing-Xshareclasses:exclude={java/util/HashMap,java/lang/invoke/LambdaForm*}
-----excludeHashMap
andLamdaForm
classes from sharing