Understanding how to diagnose problems that might occur
will help you to use shared classes mode.
For an introduction to shared classes, see .
Deploying shared classes
You cannot enable class sharing without considering how
to deploy it sensibly for your application. This section looks at
some of the important issues to consider.
Dealing with runtime bytecode modification
Modifying bytecode at runtime is an increasingly popular
way to engineer required function into classes. Sharing modified bytecode
improves startup time, especially when the modification being used
is expensive. You can safely cache modified bytecode and share it
between JVMs, but there are many potential problems because of the
added complexity. It is important to understand the features described
in this section to avoid any potential problems.
Understanding dynamic updates
The shared class cache must respond to file system updates;
otherwise, a JVM might load classes from the cache that are out of
date or "stale". After a class has been marked stale, it is not
returned by the cache if it is requested by a class loader. Instead,
the class loader must reload the class from disk and store the updated
version in the cache.
Using the Java Helper API
Classes are shared by the bootstrap class loader internally
in the JVM, but any other Java™ class
loader must use the Java Helper
API to find and store classes in the shared class cache.
Understanding shared classes diagnostics output
When running in shared classes mode, a number of diagnostics tools
can help you. The verbose options are used at runtime to show cache activity
and you can use the printStats and printAllStats utilities to analyze the
contents of a shared class cache.
Debugging problems with shared classes
The following sections describe some of the situations you might
encounter with shared classes and also the tools that are available to assist
in diagnosing problems.
Class sharing with OSGi ClassLoading framework
Eclipse releases after 3.0 use the OSGi ClassLoading framework,
which cannot automatically share classes. A Class Sharing adapter
has been written specifically for use with OSGi, which allows OSGi
classloaders to access the class cache.