com.ibm.oti.shared
Class SharedClassURLClasspathHelperImpl
- java.lang.Object
com.ibm.oti.shared.SharedAbstractHelper
com.ibm.oti.shared.SharedClassAbstractHelper
com.ibm.oti.shared.SharedClassURLClasspathHelperImpl
- public class SharedClassURLClasspathHelperImpl
- extends SharedClassAbstractHelper
- implements SharedClassURLClasspathHelper
Implementation of SharedClassURLClasspathHelper.
Nested Class Summary
Nested classes/interfaces inherited from interface com.ibm.oti.shared.SharedClassURLClasspathHelper |
---|
SharedClassURLClasspathHelper.IndexHolder |
Method Summary
Modifier and Type | Method and Description |
---|---|
|
addClasspathEntry(java.net.URL cpe)
|
|
confirmAllEntries()
|
|
findSharedClass(java.lang.String className,SharedClassURLClasspathHelper.IndexHolder indexFoundAtHolder)
|
|
findSharedClass(java.lang.String partition,java.lang.String className,SharedClassURLClasspathHelper.IndexHolder indexFoundAtHolder)
|
|
setClasspath(java.net.URL[] newClasspath)
|
|
storeSharedClass(java.lang.Class clazz,int foundAtIndex)
|
|
storeSharedClass(java.lang.String partition,java.lang.Class clazz,int foundAtIndex)
|
Methods inherited from class com.ibm.oti.shared.SharedClassAbstractHelper |
---|
getSharingFilter, isSharedClassCookie, setSharingFilter |
Methods inherited from class com.ibm.oti.shared.SharedAbstractHelper |
---|
getClassLoader |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.ibm.oti.shared.SharedClassHelper |
---|
getSharingFilter, setSharingFilter |
Methods inherited from interface com.ibm.oti.shared.SharedHelper |
---|
getClassLoader |
Method Detail
findSharedClass
- public byte[] findSharedClass(java.lang.String className,
- SharedClassURLClasspathHelper.IndexHolder indexFoundAtHolder)
Find a class in the shared cache using the class name given (implicitly using the caller's classpath).
See Using Classpaths
for rules on when a class will be found
Null is returned if the class cannot be found, if it is stale (see Dynamic Cache Updates
)
or if it is found for an unconfirmed entry (see Using Classpaths
).
findSharedClass
in interface SharedClassURLClasspathHelper
className
- String.
The name of the class to be found indexFoundAtHolder
- IndexHolder.
The index in the caller ClassLoader's classpath at which the class was found.
This parameter can be null if this data is not needed. findSharedClass
- public byte[] findSharedClass(java.lang.String partition,
- java.lang.String className,
- SharedClassURLClasspathHelper.IndexHolder indexFoundAtHolder)
Description copied from interface: SharedClassURLClasspathHelper
Find a class in the shared cache using the class name and partition given (implicitly using the caller's classpath).
See Finding Classes
for rules on when a class will be found
Null is returned if the class cannot be found, if it is stale (see Dynamic Cache Updates
)
or if it is found for an unconfirmed entry (see Using Classpaths
).
findSharedClass
in interface SharedClassURLClasspathHelper
partition
- String.
User-defined partition if finding modified bytecode (see Partitions). Passing null is equivalent of calling non-partition findSharedClass call.
className
- String.
The name of the class to be found indexFoundAtHolder
- IndexHolder.
The index in the caller ClassLoader's classpath at which the class was found.
This parameter can be null if this data is not needed. storeSharedClass
- public boolean storeSharedClass( java.lang.Class clazz,
- int foundAtIndex)
Description copied from interface: SharedClassURLClasspathHelper
Store a class in the shared cache using the caller's URL classpath.
The class being stored must have been defined by the caller ClassLoader and must exist in the URL location specified.
Returns true if the class is stored successfully or false otherwise.
Will return false if the class being stored was not defined by the caller ClassLoader.
Also returns false if the URL at foundAtIndex is not a file URL or if the resource it refers to does not exist.
storeSharedClass
in interface SharedClassURLClasspathHelper
clazz
- Class.
The class to store in the shared cache foundAtIndex
- int.
The index in the caller's classpath where the class was loaded from (first entry is 0). storeSharedClass
- public boolean storeSharedClass( java.lang.String partition,
- java.lang.Class clazz,
- int foundAtIndex)
Description copied from interface: SharedClassURLClasspathHelper
Store a class in the shared cache using the caller's URL classpath and with a user-defined partition.
The class being stored must have been defined by the caller ClassLoader and must exist in the URL location specified.
Returns true if the class is stored successfully or false otherwise.
Will return false if the class being stored was not defined by the caller ClassLoader.
Also returns false if the URL at foundAtIndex is not a file URL or if the resource it refers to does not exist.
storeSharedClass
in interface SharedClassURLClasspathHelper
partition
- String.
User-defined partition if storing modified bytecode (see Partitions). Passing null is equivalent of calling non-partition storeSharedClass call.
clazz
- Class.
The class to store in the shared cache foundAtIndex
- int.
The index in the caller's classpath where the class was loaded from (first entry is 0). addClasspathEntry
- public void addClasspathEntry(java.net.URL cpe)
Description copied from interface: SharedClassURLClasspathHelper
Update the helper's classpath by appending a URL (see Usage
).
Note: It is ESSENTIAL that the helper's classpath is kept up-to-date with the classloader's.
addClasspathEntry
in interface SharedClassURLClasspathHelper
cpe
- URL.
The classpath entry to append to the classpath confirmAllEntries
- public void confirmAllEntries()
Description copied from interface: SharedClassURLClasspathHelper
Confirms all entries in the current classpath. Any new entries added will not automatically be confirmed.
Note that if all entries are confirmed, setClasspath cannot be used to modify the classpath, only to append new entries.
(see Efficient use...
).
confirmAllEntries
in interface SharedClassURLClasspathHelper
setClasspath
- public void setClasspath(java.net.URL[] newClasspath)
- throws CannotSetClasspathException
Description copied from interface: SharedClassURLClasspathHelper
Update the 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 using this function.
Note: It is ESSENTIAL that the helper's classpath is kept up-to-date with the classloader's.
The classpath passed to this function must be exactly the same as the original
classpath upto and including the right-most entry that classes have been loaded from (the right-most confirmed
entry).
Throws a CannotSetClasspathException if this is not the case (see Modifying Classpaths
).
Once the classpath has been updated, any indexes passed to storeSharedClass and returned from findSharedClass correspond to the new classpath.
setClasspath
in interface SharedClassURLClasspathHelper
Description copied from interface:
SharedClassURLClasspathHelper