|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.oti.shared.SharedAbstractHelper
com.ibm.oti.shared.SharedClassAbstractHelper
com.ibm.oti.shared.SharedClassURLClasspathHelperImpl
public class SharedClassURLClasspathHelperImpl
Implementation of SharedClassURLClasspathHelper.
SharedClassURLClasspathHelper
,
SharedClassHelperFactory
,
SharedClassAbstractHelper
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface com.ibm.oti.shared.SharedClassURLClasspathHelper |
---|
SharedClassURLClasspathHelper.IndexHolder |
Method Summary | |
---|---|
void |
addClasspathEntry(java.net.URL cpe)
Update the helper's classpath by appending a URL (see "Usage" above). |
void |
confirmAllEntries()
Confirms all entries in the current classpath. |
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). |
byte[] |
findSharedClass(java.lang.String partition,
java.lang.String className,
SharedClassURLClasspathHelper.IndexHolder indexFoundAtHolder)
Find a class in the shared cache using the class name and partition given (implicitly using the caller's classpath). |
void |
setClasspath(java.net.URL[] newClasspath)
Update the helper's classpath with a new classpath. |
boolean |
storeSharedClass(java.lang.Class clazz,
int foundAtIndex)
Store a class in the shared cache using the caller's URL classpath. |
boolean |
storeSharedClass(java.lang.String partition,
java.lang.Class clazz,
int foundAtIndex)
Store a class in the shared cache using the caller's URL classpath and with a user-defined partition. |
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 |
---|
equals, 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 |
---|
public byte[] findSharedClass(java.lang.String className, SharedClassURLClasspathHelper.IndexHolder indexFoundAtHolder)
SharedClassURLClasspathHelper
See "Using Classpaths" above 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" above)
or if it is found for an unconfirmed entry (see "Using Classpaths" above).
findSharedClass
in interface SharedClassURLClasspathHelper
className
- String.
The name of the class to be foundindexFoundAtHolder
- 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.
public byte[] findSharedClass(java.lang.String partition, java.lang.String className, SharedClassURLClasspathHelper.IndexHolder indexFoundAtHolder)
SharedClassURLClasspathHelper
See "Finding Classes" above 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" above)
or if it is found for an unconfirmed entry (see "Using Classpaths" above).
findSharedClass
in interface SharedClassURLClasspathHelper
partition
- String.
User-defined partition if finding modified bytecode (see "Partitions" above).
Passing null is equivalent of calling non-partition findSharedClass call.className
- String.
The name of the class to be foundindexFoundAtHolder
- 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.
public boolean storeSharedClass(java.lang.Class clazz, int foundAtIndex)
SharedClassURLClasspathHelper
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 cachefoundAtIndex
- int.
The index in the caller's classpath where the class was loaded from (first entry is 0).
public boolean storeSharedClass(java.lang.String partition, java.lang.Class clazz, int foundAtIndex)
SharedClassURLClasspathHelper
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" above).
Passing null is equivalent of calling non-partition storeSharedClass call.clazz
- Class.
The class to store in the shared cachefoundAtIndex
- int.
The index in the caller's classpath where the class was loaded from (first entry is 0).
public void addClasspathEntry(java.net.URL cpe)
SharedClassURLClasspathHelper
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 classpathpublic void confirmAllEntries()
SharedClassURLClasspathHelper
Note that if all entries are confirmed, setClasspath cannot be used to modify the classpath, only to append new entries.
(see "Efficient use..." above).
confirmAllEntries
in interface SharedClassURLClasspathHelper
public void setClasspath(java.net.URL[] newClasspath) throws CannotSetClasspathException
SharedClassURLClasspathHelper
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 rightmost entry that classes have been loaded from (the righmost "confirmed" entry).
Throws a CannotSetClasspathException if this is not the case (see "Modifying Classpaths" above).
Once the classpath has been updated, any indexes passed to storeSharedClass and returned from findSharedClass correspond to the new classpath.
setClasspath
in interface SharedClassURLClasspathHelper
newClasspath
- The new URL classpath array
CannotSetClasspathException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |