| <!DOCTYPE HTML> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc --> |
| <title>SharedClassURLClasspathHelper (OpenJ9 JDK 11)</title> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="keywords" content="com.ibm.oti.shared.SharedClassURLClasspathHelper interface"> |
| <meta name="keywords" content="findSharedClass()"> |
| <meta name="keywords" content="storeSharedClass()"> |
| <meta name="keywords" content="addClasspathEntry()"> |
| <meta name="keywords" content="setClasspath()"> |
| <meta name="keywords" content="confirmAllEntries()"> |
| <link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../jquery/jquery-ui.css" title="Style"> |
| <script type="text/javascript" src="../../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../../jquery/jszip/dist/jszip.min.js"></script> |
| <script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils.min.js"></script> |
| <!--[if IE]> |
| <script type="text/javascript" src="../../../../../jquery/jszip-utils/dist/jszip-utils-ie.min.js"></script> |
| <![endif]--> |
| <script type="text/javascript" src="../../../../../jquery/jquery-3.5.1.js"></script> |
| <script type="text/javascript" src="../../../../../jquery/jquery-ui.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="SharedClassURLClasspathHelper (OpenJ9 JDK 11)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var data = {"i0":6,"i1":6,"i2":6,"i3":6,"i4":6,"i5":6,"i6":6}; |
| var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],4:["t3","Abstract Methods"]}; |
| var altColor = "altColor"; |
| var rowColor = "rowColor"; |
| var tableTab = "tableTab"; |
| var activeTableTab = "activeTableTab"; |
| var pathtoroot = "../../../../../"; |
| var useModuleDirectories = true; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <header role="banner"> |
| <nav role="navigation"> |
| <div class="fixedNav"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a id="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../index.html">Overview</a></li> |
| <li><a href="../../../../module-summary.html">Module</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/SharedClassURLClasspathHelper.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-files/index-1.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage"><div style="margin-top: 9px;"><strong>OpenJ9 JDK 11</strong></div></div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <ul class="navListSearch"> |
| <li><label for="search">SEARCH:</label> |
| <input type="text" id="search" value="search" disabled="disabled"> |
| <input type="reset" id="reset" value="reset" disabled="disabled"> |
| </li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_top"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| </div> |
| <div class="navPadding"> </div> |
| <script type="text/javascript"><!-- |
| $('.navPadding').css('padding-top', $('.fixedNav').css("height")); |
| //--> |
| </script> |
| </nav> |
| </header> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <main role="main"> |
| <div class="header"> |
| <div class="subTitle"><span class="moduleLabelInType">Module</span> <a href="../../../../module-summary.html">openj9.sharedclasses</a></div> |
| <div class="subTitle"><span class="packageLabelInType">Package</span> <a href="package-summary.html">com.ibm.oti.shared</a></div> |
| <h2 title="Interface SharedClassURLClasspathHelper" class="title">Interface SharedClassURLClasspathHelper</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Superinterfaces:</dt> |
| <dd><code><a href="SharedClassHelper.html" title="interface in com.ibm.oti.shared">SharedClassHelper</a></code>, <code><a href="SharedHelper.html" title="interface in com.ibm.oti.shared">SharedHelper</a></code></dd> |
| </dl> |
| <hr> |
| <pre>public interface <span class="typeNameLabel">SharedClassURLClasspathHelper</span> |
| extends <a href="SharedClassHelper.html" title="interface in com.ibm.oti.shared">SharedClassHelper</a></pre> |
| <div class="block"><p>SharedClassHelper API that stores and finds classes by using URL classpaths.</p> |
| <h2>Description</h2> |
| <p>A SharedClassURLClasspathHelper is obtained by calling getURLClasspathHelper(ClassLoader, URL[]) on a SharedClassHelperFactory.</p> |
| <p>The SharedClassURLClasspathHelper is designed for ClassLoaders that load classes using a classpath comprised of a sequence of URLs. |
| It is assumed that classpaths are searched left-most to right-most and can only be modified in predictable ways as described in <q>Usage</q>.</p> |
| <h2>Usage</h2> |
| <p>The ClassLoader should call findSharedClass after asking its parent (if one exists). |
| If findSharedClass does not return null, the ClassLoader calls defineClass on the byte[] that is returned.</p> |
| <p>The ClassLoader calls storeSharedClass immediately after a class is defined, unless the class that is being defined was loaded from the shared cache.</p> |
| <p>The ClassLoader must keep the helper up to date with regard to classpath changes. If the ClassLoader classpath is appended to, the ClassLoader must call addClasspathEntry(URL) on the helper. |
| If the ClassLoader classpath is modified in any other way, the ClassLoader must call setClasspath(URL[]).</p> |
| <p>If partitions are required, the ClassLoader is responsible for coordinating the creation and use of partition Strings (see <q>Using classpaths</q>).</p> |
| <p>Classes can be stored only by using URLs that have file or jar protocols, and that refer to existing resources. |
| The presence of any other protocol in a URL prevents SharedClassURLClasspathHelper from locating and storing classes in the shared cache.</p> |
| <h2>Using classpaths</h2> |
| <p>When a findSharedClass request is made from a SharedClassURLClasspathHelper, the shared cache determines whether to return a class |
| by comparing the caller's classpath to the classpath or URL that the class was stored against. Classpaths do not have to explicitly match.</p> |
| <p> |
| For example, a class c1 loaded from c.jar and stored using classpath a.jar;b.jar;c.jar;d.jar may be found by using the following classpaths:</p> |
| <ul> |
| <li>a.jar;c.jar ... (It is known that a.jar does not contain a c1)</li> |
| <li>b.jar;c.jar ... (It is known that b.jar does not contain a c1)</li> |
| <li>b.jar;a.jar;c.jar ... (likewise in whatever order)</li> |
| <li>c.jar ...</li> |
| </ul> |
| <p>However, it will not be found by using the following classpath:</p> |
| <ul> |
| <li>d.jar;a.jar;b.jar;c.jar ... (It is not known whether a different c1 exists in d.jar or not)</li> |
| </ul> |
| <p>To ensure that findSharedClass returns correct results, it returns only classes that are found for entries up to and including the right-most |
| <q>confirmed</q> entry. The definition of a confirmed entry is that it has been opened and read by the ClassLoader. Entries are confirmed by calling |
| storeSharedClass (every entry up to and including the index used is confirmed) or by calling confirmAllEntries(). The latter should only be used if |
| the classpath is guaranteed not to change (but can still be appended to).</p> |
| <p>Note that if findSharedClass returns null for whatever reason (even though the cache has the required class), calling storeSharedClass(...) |
| on the class loaded from disk is the correct thing to do. This confirms the classpath entry, and the cache does not store a duplicate class.</p> |
| <p>In this way, classes can be shared as effectively as possible between class loaders using different classpaths or URL helper types.</p> |
| <p>Note that two identical classes are never stored twice in the class cache, but many entries may exist for the same class. |
| For example, if class X is stored from a.jar and also from b.jar, the class will exist once in the cache, but will have two entries.</p> |
| <h2>Modifying classpaths</h2> |
| <p>It is possible that the classpath of a ClassLoader may change after it is initially set. There is a jar extension mechanism, for example, |
| that allows a jar to define a lookup order of other jars within its manifest. If this causes the classpath to change, then the helper |
| <b>must</b> be informed of the update.</p> |
| <p>After an initial classpath has been set in SharedClassURLClasspathHelper, classpath entries in it are <q>confirmed</q> as classes are stored in the cache |
| from these entries. For example given classpath a.jar;b.jar;c.jar;d.jar, if a class is stored from b.jar then both a.jar and b.jar are confirmed |
| because the ClassLoader must have opened both of them.</p> |
| <p>After classpath entries are confirmed, they cannot be changed, so setClasspath may only make changes to parts of the classpath that are not yet confirmed. |
| For example in the given example, a.jar;b.jar;x.jar;c.jar is acceptable, whereas a.jar;x.jar;b.jar;c.jar;d.jar is not. If an attempt is made to make |
| changes to confirmed classpath entries, a CannotSetClasspathException is thrown.</p> |
| <h2>Dynamic cache updates</h2> |
| <p>Because the shared cache persists beyond the lifetime of a JVM, classes in the shared cache can become out of date (stale). |
| Classes in the cache are automatically kept up to date by default.</p> |
| <p>If findSharedClass is called for a class that exists in the cache but which has been updated on the filesystem since it was stored, |
| then the old version in the cache is automatically marked stale and findSharedClass returns null. |
| The ClassLoader should then store the updated version of the class.</p> |
| <p>Note that jar/zip updates cause all cache entries that are loaded from that jar/zip to be marked stale. |
| Since a classpath has a specific search order, an update to a jar/zip will also cause all classes that are |
| loaded from URLs to the right-side of that entry to also become stale. |
| This is because the updated zip/jar may now contain classes that <q>hide</q> other classes to the right-side of it in the classpath.</p> |
| <p>For example, class c1 is loaded from c.jar and is stored in the cache using classpath a.jar;b.jar;c.jar.</p> |
| <p>a.jar is then updated to include a version of c1 and findSharedClass is called for c1.</p> |
| <p>It is essential that findSharedClass does not then return the version of c1 in c.jar. |
| It will detect the change, return null and c1 from a.jar should then be stored.</p> |
| <p>(This behaviour can be disabled by using the correct command-line option, but this is not recommended. See -Xshareclasses:help.)</p> |
| <p>It is also assumed that after a jar/zip has been opened, the ClassLoader maintains a read lock on that file during its lifetime, |
| preventing its modification. This prevents the cache from having to constantly check for updates. |
| However, it is understood that non-existent jars/zips on a classpath can only be locked if/when they exist. </p> |
| <h2>Partitions</h2> |
| <p>A partition can be used when finding or storing a class, which allows modified versions of the same class |
| to be stored in the cache, effectively creating <q>partitions</q> in the cache.</p> |
| <p>Partitions are designed for bytecode modification such as the use of Aspects. It is the responsibility of the ClassLoader |
| to create partitions that describe the type of modification performed on the class bytes.</p> |
| <p>If a class is updated on the filesystem and automatic dynamic updates are enabled, then all versions of the class across |
| all partitions will be marked stale.</p> |
| <h2>Class metadata</h2> |
| <p>A ClassLoader can create metadata when loading and defining classes, such as a jar manifest or security data. |
| None of this metadata can be stored in the cache, so if a ClassLoader is finding classes in the shared cache, it must load |
| any metadata that it needs from disk before defining the classes.</p> |
| <p> |
| Example:<br> |
| For static metadata specific to URL classpath entries (such as Manifest/CodeSource information), a suggested solution is to create |
| a local array to cache the metadata when it is loaded from disk. When findSharedClass is called and an index is returned, look to see |
| if metadata is already cached in the local array for that index. If it is, define the class. If not, load the class from disk to obtain |
| the metadata, cache it in the local array, define the class, and then call storeSharedClass on it (it doesn't matter if it is already in the cache). |
| All future results from findSharedClass for that classpath entry can then use the cached metadata.</p> |
| <p>If findSharedClass returns null, then load the class from disk, cache the metadata from the entry anyway, define the class, and store it.</p> |
| <h2>Security</h2> |
| <p>A SharedClassHelper will only allow classes that were defined by the ClassLoader that owns the SharedClassHelper to be stored in the cache.</p> |
| <p>If a SecurityManager is installed, SharedClassPermissions must be used to permit read/write access to the shared class cache. |
| Permissions are granted by ClassLoader classname in the java.policy file and are fixed when the SharedClassHelper is created.</p> |
| <p>Note also that if the createClassLoader RuntimePermission is not granted, ClassLoaders cannot be created, |
| which in turn means that SharedClassHelpers cannot be created.</p> |
| <h2>Efficient use of the SharedClassURLClasspathHelper</h2> |
| Here are some recommendations on using the SharedClassURLClasspathHelper:<br> |
| <ol> |
| <li>It is best not to start with a zero length classpath and gradually grow it. Each classpath change causes a new classpath to be added to the |
| cache and reduces the number of optimizations that can be made when matching classpaths.</li> |
| <li>If the ClassLoader will never call setClasspath, then use confirmAllEntries immediately after obtaining the helper. This ensures that |
| findSharedClass will never return null due to unconfirmed entries.</li> |
| </ol> |
| <h2>Compatibility with other SharedClassHelpers</h2> |
| <p>Classes stored by using the SharedClassURLClasspathHelper can be retrieved by using the SharedClassURLHelper and vice versa. |
| This is also true for partitions that can be used across these two helpers.</p></div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="SharedClassURLClasspathHelper.html" title="interface in com.ibm.oti.shared"><code>SharedClassURLClasspathHelper</code></a>, |
| <a href="SharedClassHelperFactory.html" title="interface in com.ibm.oti.shared"><code>SharedClassHelperFactory</code></a>, |
| <a href="SharedClassPermission.html" title="class in com.ibm.oti.shared"><code>SharedClassPermission</code></a></dd> |
| </dl> |
| </li> |
| </ul> |
| </div> |
| <div class="summary"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="nested.class.summary"> |
| <!-- --> |
| </a> |
| <h3>Nested Class Summary</h3> |
| <table class="memberSummary"> |
| <caption><span>Nested Classes</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Interface</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code>static interface </code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="SharedClassURLClasspathHelper.IndexHolder.html" title="interface in com.ibm.oti.shared">SharedClassURLClasspathHelper.IndexHolder</a></span></code></th> |
| <td class="colLast"> |
| <div class="block">Interface that allows an index to be returned from findSharedClass calls.</div> |
| </td> |
| </tr> |
| </table> |
| </li> |
| </ul> |
| </section> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary"> |
| <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd"> </span></span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colSecond" scope="col">Method</th> |
| <th class="colLast" scope="col">Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#addClasspathEntry(java.net.URL)">addClasspathEntry</a></span>​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html?is-external=true" title="class or interface in java.net" class="externalLink" target="_blank">URL</a> cpe)</code></th> |
| <td class="colLast"> |
| <div class="block">Updates the helper's classpath by appending a URL (see <q>Usage</q>).</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#confirmAllEntries()">confirmAllEntries</a></span>()</code></th> |
| <td class="colLast"> |
| <div class="block">Confirms all entries in the current classpath.</div> |
| </td> |
| </tr> |
| <tr id="i2" class="altColor"> |
| <td class="colFirst"><code>byte[]</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#findSharedClass(java.lang.String,com.ibm.oti.shared.SharedClassURLClasspathHelper.IndexHolder)">findSharedClass</a></span>​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink" target="_blank">String</a> className, |
| <a href="SharedClassURLClasspathHelper.IndexHolder.html" title="interface in com.ibm.oti.shared">SharedClassURLClasspathHelper.IndexHolder</a> indexFoundAt)</code></th> |
| <td class="colLast"> |
| <div class="block">Finds a class in the shared cache by using the class name given (implicitly using the caller's classpath).</div> |
| </td> |
| </tr> |
| <tr id="i3" class="rowColor"> |
| <td class="colFirst"><code>byte[]</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#findSharedClass(java.lang.String,java.lang.String,com.ibm.oti.shared.SharedClassURLClasspathHelper.IndexHolder)">findSharedClass</a></span>​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink" target="_blank">String</a> partition, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink" target="_blank">String</a> className, |
| <a href="SharedClassURLClasspathHelper.IndexHolder.html" title="interface in com.ibm.oti.shared">SharedClassURLClasspathHelper.IndexHolder</a> indexFoundAt)</code></th> |
| <td class="colLast"> |
| <div class="block">Finds a class in the shared cache by using the class name and partition given (implicitly using the caller's classpath).</div> |
| </td> |
| </tr> |
| <tr id="i4" class="altColor"> |
| <td class="colFirst"><code>void</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#setClasspath(java.net.URL%5B%5D)">setClasspath</a></span>​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html?is-external=true" title="class or interface in java.net" class="externalLink" target="_blank">URL</a>[] newClasspath)</code></th> |
| <td class="colLast"> |
| <div class="block">Updates the helper's classpath with a new classpath.</div> |
| </td> |
| </tr> |
| <tr id="i5" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#storeSharedClass(java.lang.Class,int)">storeSharedClass</a></span>​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink" target="_blank">Class</a><?> clazz, |
| int foundAtIndex)</code></th> |
| <td class="colLast"> |
| <div class="block">Stores a class in the shared cache by using the caller's URL classpath.</div> |
| </td> |
| </tr> |
| <tr id="i6" class="altColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#storeSharedClass(java.lang.String,java.lang.Class,int)">storeSharedClass</a></span>​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink" target="_blank">String</a> partition, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink" target="_blank">Class</a><?> clazz, |
| int foundAtIndex)</code></th> |
| <td class="colLast"> |
| <div class="block">Stores a class in the shared cache by using the caller's URL classpath and with a user-defined partition.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a id="methods.inherited.from.class.com.ibm.oti.shared.SharedClassHelper"> |
| <!-- --> |
| </a> |
| <h3>Methods declared in interface com.ibm.oti.shared.<a href="SharedClassHelper.html" title="interface in com.ibm.oti.shared">SharedClassHelper</a></h3> |
| <code><a href="SharedClassHelper.html#getSharingFilter()">getSharingFilter</a>, <a href="SharedClassHelper.html#setSharingFilter(com.ibm.oti.shared.SharedClassFilter)">setSharingFilter</a></code></li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a id="methods.inherited.from.class.com.ibm.oti.shared.SharedHelper"> |
| <!-- --> |
| </a> |
| <h3>Methods declared in interface com.ibm.oti.shared.<a href="SharedHelper.html" title="interface in com.ibm.oti.shared">SharedHelper</a></h3> |
| <code><a href="SharedHelper.html#getClassLoader()">getClassLoader</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ METHOD DETAIL ========== --> |
| <section role="region"> |
| <ul class="blockList"> |
| <li class="blockList"><a id="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a id="findSharedClass(java.lang.String,com.ibm.oti.shared.SharedClassURLClasspathHelper.IndexHolder)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>findSharedClass</h4> |
| <pre class="methodSignature">byte[] findSharedClass​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink" target="_blank">String</a> className, |
| <a href="SharedClassURLClasspathHelper.IndexHolder.html" title="interface in com.ibm.oti.shared">SharedClassURLClasspathHelper.IndexHolder</a> indexFoundAt)</pre> |
| <div class="block"><p>Finds a class in the shared cache by using the class name given (implicitly using the caller's classpath).</p> |
| |
| <p>See <q>Using classpaths</q> for rules on when a class will be found.<br> |
| Null is returned if the class cannot be found, if it is stale (see <q>Dynamic cache updates</q>) |
| or if it is found for an unconfirmed entry (see <q>Using classpaths</q>).</p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>className</code> - String. |
| The name of the class to be found</dd> |
| <dd><code>indexFoundAt</code> - 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.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>byte[]. |
| A byte array describing the class found, or null.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="findSharedClass(java.lang.String,java.lang.String,com.ibm.oti.shared.SharedClassURLClasspathHelper.IndexHolder)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>findSharedClass</h4> |
| <pre class="methodSignature">byte[] findSharedClass​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink" target="_blank">String</a> partition, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink" target="_blank">String</a> className, |
| <a href="SharedClassURLClasspathHelper.IndexHolder.html" title="interface in com.ibm.oti.shared">SharedClassURLClasspathHelper.IndexHolder</a> indexFoundAt)</pre> |
| <div class="block"><p>Finds a class in the shared cache by using the class name and partition given (implicitly using the caller's classpath).</p> |
| <p>See <q>Using classpaths</q> for rules on when a class will be found.<br> |
| Null is returned if the class cannot be found, if it is stale (see <q>Dynamic cache updates</q>) |
| or if it is found for an unconfirmed entry (see <q>Using classpaths</q>).</p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>partition</code> - String. |
| User-defined partition if finding modified bytecode (see <q>Partitions</q>). |
| Passing null is equivalent of calling non-partition findSharedClass call.</dd> |
| <dd><code>className</code> - String. |
| The name of the class to be found</dd> |
| <dd><code>indexFoundAt</code> - 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.</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>byte[]. |
| A byte array describing the class found, or null.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="storeSharedClass(java.lang.Class,int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>storeSharedClass</h4> |
| <pre class="methodSignature">boolean storeSharedClass​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink" target="_blank">Class</a><?> clazz, |
| int foundAtIndex)</pre> |
| <div class="block"><p>Stores a class in the shared cache by using the caller's URL classpath.</p> |
| <p>The class being stored must have been defined by the caller ClassLoader and must exist in the URL location specified.</p> |
| <p>Returns <code>true</code> if the class is stored successfully or <code>false</code> otherwise.</p> |
| <p>Will return <code>false</code> if the class being stored was not defined by the caller ClassLoader.</p> |
| <p>Also returns <code>false</code> if the URL at foundAtIndex is not a file URL or if the resource it refers to does not exist. </p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>clazz</code> - Class. |
| The class to store in the shared cache</dd> |
| <dd><code>foundAtIndex</code> - int. |
| The index in the caller's classpath where the class was loaded from (first entry is 0).</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>boolean. |
| True if the class was stored successfully, false otherwise.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="storeSharedClass(java.lang.String,java.lang.Class,int)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>storeSharedClass</h4> |
| <pre class="methodSignature">boolean storeSharedClass​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/String.html?is-external=true" title="class or interface in java.lang" class="externalLink" target="_blank">String</a> partition, |
| <a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Class.html?is-external=true" title="class or interface in java.lang" class="externalLink" target="_blank">Class</a><?> clazz, |
| int foundAtIndex)</pre> |
| <div class="block"><p>Stores a class in the shared cache by using the caller's URL classpath and with a user-defined partition.</p> |
| |
| <p>The class that is being stored must have been defined by the caller ClassLoader and must exist in the URL location specified.</p> |
| <p>Returns <code>true</code> if the class is stored successfully or <code>false</code> otherwise.</p> |
| <p>Will return <code>false</code> if the class that is being stored was not defined by the caller ClassLoader.</p> |
| <p>Also returns <code>false</code> if the URL at foundAtIndex is not a file URL or if the resource it refers to does not exist. </p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>partition</code> - String. |
| User-defined partition if storing modified bytecode (see <q>Partitions</q>). |
| Passing null is equivalent of calling non-partition storeSharedClass call.</dd> |
| <dd><code>clazz</code> - Class. |
| The class to store in the shared cache</dd> |
| <dd><code>foundAtIndex</code> - int. |
| The index in the caller's classpath where the class was loaded from (first entry is 0).</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>boolean. |
| True if the class was stored successfully, false otherwise.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="addClasspathEntry(java.net.URL)"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>addClasspathEntry</h4> |
| <pre class="methodSignature">void addClasspathEntry​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html?is-external=true" title="class or interface in java.net" class="externalLink" target="_blank">URL</a> cpe)</pre> |
| <div class="block"><p>Updates the helper's classpath by appending a URL (see <q>Usage</q>).</p> |
| |
| <p><b>Note:</b> It is <b>essential</b> that the helper's classpath is kept up-to-date with the classloader.</p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>cpe</code> - URL. |
| The classpath entry to append to the classpath</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="setClasspath(java.net.URL[])"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>setClasspath</h4> |
| <pre class="methodSignature">void setClasspath​(<a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/net/URL.html?is-external=true" title="class or interface in java.net" class="externalLink" target="_blank">URL</a>[] newClasspath) |
| throws <a href="CannotSetClasspathException.html" title="class in com.ibm.oti.shared">CannotSetClasspathException</a></pre> |
| <div class="block"><p>Updates the helper's classpath with a new classpath.</p> |
| |
| <p>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.</p> |
| <p><b>Note:</b> It is essential that the helper's classpath is kept up-to-date with the classloader.</p> |
| |
| <p>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 <q>confirmed</q> entry).</p> |
| <p>Throws a CannotSetClasspathException if this is not the case (see <q>Modifying classpaths</q>).</p> |
| |
| <p>After the classpath has been updated, any indexes passed to storeSharedClass and returned from |
| findSharedClass correspond to the new classpath.</p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>newClasspath</code> - The new URL classpath array</dd> |
| <dt><span class="throwsLabel">Throws:</span></dt> |
| <dd><code><a href="CannotSetClasspathException.html" title="class in com.ibm.oti.shared">CannotSetClasspathException</a></code> - when the class path cannot be set.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a id="confirmAllEntries()"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>confirmAllEntries</h4> |
| <pre class="methodSignature">void confirmAllEntries()</pre> |
| <div class="block"><p>Confirms all entries in the current classpath. |
| Any new entries added will not automatically be confirmed.</p> |
| |
| <p>Note that if all entries are confirmed, setClasspath cannot be used to modify the classpath, only to append new entries. |
| (see <q>Efficient use of the SharedClassURLClasspathHelper</q>).</p></div> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </div> |
| </div> |
| </main> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <footer role="contentinfo"> |
| <nav role="navigation"> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a id="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a id="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../../index.html">Overview</a></li> |
| <li><a href="../../../../module-summary.html">Module</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/SharedClassURLClasspathHelper.html">Use</a></li> |
| <li><a href="package-tree.html">Tree</a></li> |
| <li><a href="../../../../../deprecated-list.html">Deprecated</a></li> |
| <li><a href="../../../../../index-files/index-1.html">Index</a></li> |
| <li><a href="../../../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage"><div style="margin-top: 9px;"><strong>OpenJ9 JDK 11</strong></div></div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../../allclasses.html">All Classes</a></li> |
| </ul> |
| <div> |
| <script type="text/javascript"><!-- |
| allClassesLink = document.getElementById("allclasses_navbar_bottom"); |
| if(window==top) { |
| allClassesLink.style.display = "block"; |
| } |
| else { |
| allClassesLink.style.display = "none"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li><a href="#nested.class.summary">Nested</a> | </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.summary">Method</a></li> |
| </ul> |
| <ul class="subNavList"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method.detail">Method</a></li> |
| </ul> |
| </div> |
| <a id="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| </nav> |
| <p class="legalCopy"><small><a href="https://www.eclipse.org/openj9/" target="_blank">Eclipse OpenJ9 website.</a><br> To raise a bug report or suggest an improvement create an <a href="https://github.com/eclipse-openj9/openj9/issues" target="_blank">Eclipse Openj9 issue.</a><br> Copyright © 1998, 2021, IBM Corp. and others.</small></p> |
| </footer> |
| </body> |
| </html> |