1

When we start any java app then first all the classes within rt.jar gets loaded & then the app starts working as its been designed for and at the end the ShutDownHook class gets invoked for wrapping up the stuff before we exit. I was wondering is there any way with which we restrict any class within rt.jar from getting loaded so they wont get used on the developed app. One shortcoming i foresee with it is in case wherever that class being used within rt.jar will also gets failed. Is there any other way to achieve this !!

Apart we know that if we enable CDS (class data sharing) on different java apps deployed on same machine will cut down the loading time of all apps & even saves the memory on account that all of them using/sharing the same memory space for loading common startup libraries. Can we include custom class within the CDS territory in order to achieve inter JVM data sharing (I know for inter JVM data sharing there are other options too but would like to explore this option in particular)!!

Avis
  • 2,197
  • 18
  • 28
  • Aspect-oriented programming (AOP) would allow you at least to detect (and maybe override?) interactions with an rt.jar class, if my second-hand understanding is correct. AspectJ is an AOP extension for Java. Before investing in that, however, it would be worthwhile to consider what you're trying to accomplish, and whether your change would break clients of the class in the same library. – Andy Thomas May 05 '15 at 21:25
  • Your second question appears to be a duplicate of http://stackoverflow.com/questions/13496307/can-multiple-jvm-processes-share-memory-for-common-classes . – Andy Thomas May 05 '15 at 21:25

0 Answers0