- All Implemented Interfaces:
com.ibm.sharedclasses.spi.SharedClassProvider
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreatePermission(String classLoaderClassName, String actions) Constructs a new instance of SharedClassPermission which is a sub-class of BasicPermission.byte[]findSharedClassURL(URL path, String className) Finds a class in the shared cache by using a specific URL and class name.byte[]findSharedClassURLClasspath(String className, IntConsumer indexConsumer) Finds a class in the shared cache by using the class name given (implicitly using the caller's classpath).longReturns the size of the cache that the JVM is currently connected to.longReturns the free space in bytes of the cache that the JVM is currently connected to.longReturns the maximum space allowed for AOT data of the cache that the JVM is currently connected to.longReturns the maximum space allowed for JIT data of the cache that the JVM is currently connected to.longReturns the minimum space reserved for AOT data of the cache that the JVM is currently connected to.longReturns the minimum space reserved for JIT data of the cache that the JVM is currently connected to.longReturns the soft limit in bytes for the available space of the cache that the JVM is currently connected to.com.ibm.sharedclasses.spi.SharedClassProviderinitializeProvider(ClassLoader loader, URL[] classpath) Initializes a SharedClassProvider.com.ibm.sharedclasses.spi.SharedClassProviderinitializeProvider(ClassLoader loader, URL[] classpath, boolean urlHelper, boolean tokenHelper) Initializes a SharedClassProvider.booleanChecks whether shared classes are enabled for this JVM.booleansetURLClasspath(URL[] newClasspath) Updates the URLClasspath helper's classpath with a new classpath.booleanstoreSharedClassURL(URL path, Class<?> clazz) Stores a class in the shared cache by using the URL location it was loaded from.booleanstoreSharedClassURLClasspath(Class<?> clazz, int foundAtIndex) Stores a class in the shared cache by using the caller's URL classpath.
-
Constructor Details
-
SharedClassProviderImpl
public SharedClassProviderImpl()
-
-
Method Details
-
initializeProvider
public com.ibm.sharedclasses.spi.SharedClassProvider initializeProvider(ClassLoader loader, URL[] classpath) Description copied from interface:com.ibm.sharedclasses.spi.SharedClassProviderInitializes a SharedClassProvider.
- Specified by:
initializeProviderin interfacecom.ibm.sharedclasses.spi.SharedClassProvider- Parameters:
loader- ClassLoader The ClassLoader that uses SharedClassProvider.classpath- URL[] The current URL classpath array of the ClassLoader.- Returns:
- SharedClassProvider A SharedClassProvider if it is successfully initialized, or null otherwise.
-
initializeProvider
public com.ibm.sharedclasses.spi.SharedClassProvider initializeProvider(ClassLoader loader, URL[] classpath, boolean urlHelper, boolean tokenHelper) Description copied from interface:com.ibm.sharedclasses.spi.SharedClassProviderInitializes a SharedClassProvider.
- Specified by:
initializeProviderin interfacecom.ibm.sharedclasses.spi.SharedClassProvider- Parameters:
loader- ClassLoader The ClassLoader that uses SharedClassProvider.classpath- URL[] The current URL classpath array of the ClassLoader.urlHelper- True if a SharedClassURLHelper needs to be created for this class loader, false otherwise.tokenHelper- True if a SharedClassTokenHelper needs to be created for this class loader, false otherwise.- Returns:
- SharedClassProvider A SharedClassProvider if it is successfully initialized, or null otherwise.
-
setURLClasspath
Description copied from interface:com.ibm.sharedclasses.spi.SharedClassProviderUpdates the URLClasspath helper's classpath with a new classpath.
This function is useful for ClassLoaders that compute their classpath lazily. The initial classpath is passed to the constructor optimistically, but if the classloader discovers a change while reading an entry, it can update the classpath by using this function.
Note: It is essential that the helper's classpath is kept up-to-date with the classloader.
The classpath that is passed to this function must be exactly the same as the original classpath up to and including the right-most entry that classes have been loaded from (the right-most
confirmed
entry).After the classpath has been updated, any indexes passed to storeSharedClassURLClasspath and returned from findSharedClassURLClasspath correspond to the new classpath.
- Specified by:
setURLClasspathin interfacecom.ibm.sharedclasses.spi.SharedClassProvider- Parameters:
newClasspath- The new URL classpath array- Returns:
- boolean. True if the classpath has been set, false otherwise.
-
getCacheSize
public long getCacheSize()Description copied from interface:com.ibm.sharedclasses.spi.SharedClassProviderReturns the size of the cache that the JVM is currently connected to.
- Specified by:
getCacheSizein interfacecom.ibm.sharedclasses.spi.SharedClassProvider- Returns:
- long. The total size in bytes of the shared cache.
-
getSoftmxBytes
public long getSoftmxBytes()Description copied from interface:com.ibm.sharedclasses.spi.SharedClassProviderReturns the soft limit in bytes for the available space of the cache that the JVM is currently connected to.
- Specified by:
getSoftmxBytesin interfacecom.ibm.sharedclasses.spi.SharedClassProvider- Returns:
- long. The soft max size or cache size in bytes if it is not set.
-
getMinAotBytes
public long getMinAotBytes()Description copied from interface:com.ibm.sharedclasses.spi.SharedClassProviderReturns the minimum space reserved for AOT data of the cache that the JVM is currently connected to.
- Specified by:
getMinAotBytesin interfacecom.ibm.sharedclasses.spi.SharedClassProvider- Returns:
- long. The minimum shared classes cache space reserved for AOT data in bytes or -1 if it is not set.
-
getMaxAotBytes
public long getMaxAotBytes()Description copied from interface:com.ibm.sharedclasses.spi.SharedClassProviderReturns the maximum space allowed for AOT data of the cache that the JVM is currently connected to.
- Specified by:
getMaxAotBytesin interfacecom.ibm.sharedclasses.spi.SharedClassProvider- Returns:
- long. The maximum shared classes cache space allowed for AOT data in bytes or -1 if it is not set.
-
getMinJitDataBytes
public long getMinJitDataBytes()Description copied from interface:com.ibm.sharedclasses.spi.SharedClassProviderReturns the minimum space reserved for JIT data of the cache that the JVM is currently connected to.
- Specified by:
getMinJitDataBytesin interfacecom.ibm.sharedclasses.spi.SharedClassProvider- Returns:
- long. The minimum shared classes cache space reserved for JIT data in bytes or -1 if it is not set.
-
getMaxJitDataBytes
public long getMaxJitDataBytes()Description copied from interface:com.ibm.sharedclasses.spi.SharedClassProviderReturns the maximum space allowed for JIT data of the cache that the JVM is currently connected to.
- Specified by:
getMaxJitDataBytesin interfacecom.ibm.sharedclasses.spi.SharedClassProvider- Returns:
- long. The maximum shared classes cache space allowed for JIT data in bytes or -1 if it is not set.
-
getFreeSpace
public long getFreeSpace()Description copied from interface:com.ibm.sharedclasses.spi.SharedClassProviderReturns the free space in bytes of the cache that the JVM is currently connected to.
- Specified by:
getFreeSpacein interfacecom.ibm.sharedclasses.spi.SharedClassProvider- Returns:
- long. The free space of the shared classes cache.
-
createPermission
Description copied from interface:com.ibm.sharedclasses.spi.SharedClassProviderConstructs a new instance of SharedClassPermission which is a sub-class of BasicPermission.
- Specified by:
createPermissionin interfacecom.ibm.sharedclasses.spi.SharedClassProvider- Parameters:
classLoaderClassName- java.lang.String. The class name of the class loader requiring the permission.actions- java.lang.String. The actions which are applicable to it.- Returns:
- BasicPermission. A new instance of SharedClassPermission which is a sub-class of BasicPermission, or null if shared classes are not enabled.