| <!DOCTYPE HTML> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (18) --> |
| <title>SharedClassURLClasspathHelper (OpenJ9 JDK 18)</title> |
| <meta name="viewport" content="width=device-width, initial-scale=1"> |
| <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| <meta name="description" content="declaration: module: openj9.sharedclasses, package: com.ibm.oti.shared, interface: SharedClassURLClasspathHelper"> |
| <meta name="generator" content="javadoc/ClassWriterImpl"> |
| <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="../../../../../script-dir/jquery-ui.min.css" title="Style"> |
| <link rel="stylesheet" type="text/css" href="../../../../../jquery-ui.overrides.css" title="Style"> |
| <script type="text/javascript" src="../../../../../script.js"></script> |
| <script type="text/javascript" src="../../../../../script-dir/jquery-3.5.1.min.js"></script> |
| <script type="text/javascript" src="../../../../../script-dir/jquery-ui.min.js"></script> |
| </head> |
| <body class="class-declaration-page"> |
| <script type="text/javascript">var evenRowColor = "even-row-color"; |
| var oddRowColor = "odd-row-color"; |
| var tableTab = "table-tab"; |
| var activeTableTab = "active-table-tab"; |
| var pathtoroot = "../../../../../"; |
| loadScripts(document, 'script');</script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <div class="flex-box"> |
| <header role="banner" class="flex-header"> |
| <nav role="navigation"> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="top-nav" id="navbar-top"><button id="navbar-toggle-button" aria-controls="navbar-top" aria-expanded="false" aria-label="Toggle navigation links"><span class="nav-bar-toggle-icon"></span><span class="nav-bar-toggle-icon"></span><span class="nav-bar-toggle-icon"></span></button> |
| <div class="skip-nav"><a href="#skip-navbar-top" title="Skip navigation links">Skip navigation links</a></div> |
| <div class="about-language"><div style="margin-top: 9px;"><strong>OpenJ9 JDK 18</strong></div></div> |
| <ul id="navbar-top-firstrow" class="nav-list" 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="nav-bar-cell1-rev">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#class">Help</a></li> |
| </ul> |
| <ul class="sub-nav-list-small"> |
| <li> |
| <p>Summary:</p> |
| <ul> |
| <li><a href="#nested-class-summary">Nested</a></li> |
| <li>Field</li> |
| <li>Constr</li> |
| <li><a href="#method-summary">Method</a></li> |
| </ul> |
| </li> |
| <li> |
| <p>Detail:</p> |
| <ul> |
| <li>Field</li> |
| <li>Constr</li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="sub-nav"> |
| <div id="navbar-sub-list"> |
| <ul class="sub-nav-list"> |
| <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="sub-nav-list"> |
| <li>Detail: </li> |
| <li>Field | </li> |
| <li>Constr | </li> |
| <li><a href="#method-detail">Method</a></li> |
| </ul> |
| </div> |
| <div class="nav-list-search"><label for="search-input">SEARCH:</label> |
| <input type="text" id="search-input" disabled placeholder="Search"> |
| <input type="reset" id="reset-button" disabled value="reset"> |
| </div> |
| </div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <span class="skip-nav" id="skip-navbar-top"></span></nav> |
| </header> |
| <div class="flex-content"> |
| <main role="main"> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="sub-title"><span class="module-label-in-type">Module</span> <a href="../../../../module-summary.html">openj9.sharedclasses</a></div> |
| <div class="sub-title"><span class="package-label-in-type">Package</span> <a href="package-summary.html">com.ibm.oti.shared</a></div> |
| <h1 title="Interface SharedClassURLClasspathHelper" class="title">Interface SharedClassURLClasspathHelper</h1> |
| </div> |
| <section class="class-description" id="class-description"> |
| <dl class="notes"> |
| <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> |
| <div class="type-signature"><span class="modifiers">public interface </span><span class="element-name type-name-label">SharedClassURLClasspathHelper</span><span class="extends-implements"> |
| extends <a href="SharedClassHelper.html" title="interface in com.ibm.oti.shared">SharedClassHelper</a></span></div> |
| <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 class="notes"> |
| <dt>See Also:</dt> |
| <dd> |
| <ul class="see-list"> |
| <li><a href="SharedClassURLClasspathHelper.html" title="interface in com.ibm.oti.shared"><code>SharedClassURLClasspathHelper</code></a></li> |
| <li><a href="SharedClassHelperFactory.html" title="interface in com.ibm.oti.shared"><code>SharedClassHelperFactory</code></a></li> |
| <li><a href="SharedClassPermission.html" title="class in com.ibm.oti.shared"><code>SharedClassPermission</code></a></li> |
| </ul> |
| </dd> |
| </dl> |
| </section> |
| <section class="summary"> |
| <ul class="summary-list"> |
| <!-- ======== NESTED CLASS SUMMARY ======== --> |
| <li> |
| <section class="nested-class-summary" id="nested-class-summary"> |
| <h2>Nested Class Summary</h2> |
| <div class="caption"><span>Nested Classes</span></div> |
| <div class="summary-table three-column-summary"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Interface</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color"><code>static interface </code></div> |
| <div class="col-second even-row-color"><code><a href="SharedClassURLClasspathHelper.IndexHolder.html" class="type-name-link" title="interface in com.ibm.oti.shared">SharedClassURLClasspathHelper.IndexHolder</a></code></div> |
| <div class="col-last even-row-color"> |
| <div class="block">Interface that allows an index to be returned from findSharedClass calls.</div> |
| </div> |
| </div> |
| </section> |
| </li> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <li> |
| <section class="method-summary" id="method-summary"> |
| <h2>Method Summary</h2> |
| <div id="method-summary-table"> |
| <div class="table-tabs" role="tablist" aria-orientation="horizontal"><button id="method-summary-table-tab0" role="tab" aria-selected="true" aria-controls="method-summary-table.tabpanel" tabindex="0" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table', 3)" class="active-table-tab">All Methods</button><button id="method-summary-table-tab2" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab2', 3)" class="table-tab">Instance Methods</button><button id="method-summary-table-tab3" role="tab" aria-selected="false" aria-controls="method-summary-table.tabpanel" tabindex="-1" onkeydown="switchTab(event)" onclick="show('method-summary-table', 'method-summary-table-tab3', 3)" class="table-tab">Abstract Methods</button></div> |
| <div id="method-summary-table.tabpanel" role="tabpanel"> |
| <div class="summary-table three-column-summary" aria-labelledby="method-summary-table-tab0"> |
| <div class="table-header col-first">Modifier and Type</div> |
| <div class="table-header col-second">Method</div> |
| <div class="table-header col-last">Description</div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>void</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#addClasspathEntry(java.net.URL)" class="member-name-link">addClasspathEntry</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/net/URL.html" title="class or interface in java.net" class="external-link" target="_blank">URL</a> cpe)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"> |
| <div class="block">Updates the helper's classpath by appending a URL (see <q>Usage</q>).</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>void</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#confirmAllEntries()" class="member-name-link">confirmAllEntries</a>()</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"> |
| <div class="block">Confirms all entries in the current classpath.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>byte[]</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#findSharedClass(java.lang.String,com.ibm.oti.shared.SharedClassURLClasspathHelper.IndexHolder)" class="member-name-link">findSharedClass</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link" target="_blank">String</a> className, |
| <a href="SharedClassURLClasspathHelper.IndexHolder.html" title="interface in com.ibm.oti.shared">SharedClassURLClasspathHelper.IndexHolder</a> indexFoundAt)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"> |
| <div class="block">Finds a class in the shared cache by using the class name given (implicitly using the caller's classpath).</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>byte[]</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#findSharedClass(java.lang.String,java.lang.String,com.ibm.oti.shared.SharedClassURLClasspathHelper.IndexHolder)" class="member-name-link">findSharedClass</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link" target="_blank">String</a> partition, |
| <a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link" target="_blank">String</a> className, |
| <a href="SharedClassURLClasspathHelper.IndexHolder.html" title="interface in com.ibm.oti.shared">SharedClassURLClasspathHelper.IndexHolder</a> indexFoundAt)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"> |
| <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> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>void</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#setClasspath(java.net.URL%5B%5D)" class="member-name-link">setClasspath</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/net/URL.html" title="class or interface in java.net" class="external-link" target="_blank">URL</a>[] newClasspath)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"> |
| <div class="block">Updates the helper's classpath with a new classpath.</div> |
| </div> |
| <div class="col-first odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>boolean</code></div> |
| <div class="col-second odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#storeSharedClass(java.lang.Class,int)" class="member-name-link">storeSharedClass</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link" target="_blank">Class</a><?> clazz, |
| int foundAtIndex)</code></div> |
| <div class="col-last odd-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"> |
| <div class="block">Stores a class in the shared cache by using the caller's URL classpath.</div> |
| </div> |
| <div class="col-first even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code>boolean</code></div> |
| <div class="col-second even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"><code><a href="#storeSharedClass(java.lang.String,java.lang.Class,int)" class="member-name-link">storeSharedClass</a><wbr>(<a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link" target="_blank">String</a> partition, |
| <a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link" target="_blank">Class</a><?> clazz, |
| int foundAtIndex)</code></div> |
| <div class="col-last even-row-color method-summary-table method-summary-table-tab2 method-summary-table-tab3"> |
| <div class="block">Stores a class in the shared cache by using the caller's URL classpath and with a user-defined partition.</div> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="inherited-list"> |
| <h3 id="methods-inherited-from-class-com.ibm.oti.shared.SharedClassHelper">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></div> |
| <div class="inherited-list"> |
| <h3 id="methods-inherited-from-class-com.ibm.oti.shared.SharedHelper">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></div> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <section class="details"> |
| <ul class="details-list"> |
| <!-- ============ METHOD DETAIL ========== --> |
| <li> |
| <section class="method-details" id="method-detail"> |
| <h2>Method Details</h2> |
| <ul class="member-list"> |
| <li> |
| <section class="detail" id="findSharedClass(java.lang.String,com.ibm.oti.shared.SharedClassURLClasspathHelper.IndexHolder)"> |
| <h3>findSharedClass</h3> |
| <div class="member-signature"><span class="return-type">byte[]</span> <span class="element-name">findSharedClass</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link" target="_blank">String</a> className, |
| <a href="SharedClassURLClasspathHelper.IndexHolder.html" title="interface in com.ibm.oti.shared">SharedClassURLClasspathHelper.IndexHolder</a> indexFoundAt)</span></div> |
| <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 class="notes"> |
| <dt>Parameters:</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>Returns:</dt> |
| <dd>byte[]. |
| A byte array describing the class found, or null.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="findSharedClass(java.lang.String,java.lang.String,com.ibm.oti.shared.SharedClassURLClasspathHelper.IndexHolder)"> |
| <h3>findSharedClass</h3> |
| <div class="member-signature"><span class="return-type">byte[]</span> <span class="element-name">findSharedClass</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link" target="_blank">String</a> partition, |
| <a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link" target="_blank">String</a> className, |
| <a href="SharedClassURLClasspathHelper.IndexHolder.html" title="interface in com.ibm.oti.shared">SharedClassURLClasspathHelper.IndexHolder</a> indexFoundAt)</span></div> |
| <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 class="notes"> |
| <dt>Parameters:</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>Returns:</dt> |
| <dd>byte[]. |
| A byte array describing the class found, or null.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="storeSharedClass(java.lang.Class,int)"> |
| <h3>storeSharedClass</h3> |
| <div class="member-signature"><span class="return-type">boolean</span> <span class="element-name">storeSharedClass</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link" target="_blank">Class</a><?> clazz, |
| int foundAtIndex)</span></div> |
| <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 class="notes"> |
| <dt>Parameters:</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>Returns:</dt> |
| <dd>boolean. |
| True if the class was stored successfully, false otherwise.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="storeSharedClass(java.lang.String,java.lang.Class,int)"> |
| <h3>storeSharedClass</h3> |
| <div class="member-signature"><span class="return-type">boolean</span> <span class="element-name">storeSharedClass</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/String.html" title="class or interface in java.lang" class="external-link" target="_blank">String</a> partition, |
| <a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/lang/Class.html" title="class or interface in java.lang" class="external-link" target="_blank">Class</a><?> clazz, |
| int foundAtIndex)</span></div> |
| <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 class="notes"> |
| <dt>Parameters:</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>Returns:</dt> |
| <dd>boolean. |
| True if the class was stored successfully, false otherwise.</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="addClasspathEntry(java.net.URL)"> |
| <h3>addClasspathEntry</h3> |
| <div class="member-signature"><span class="return-type">void</span> <span class="element-name">addClasspathEntry</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/net/URL.html" title="class or interface in java.net" class="external-link" target="_blank">URL</a> cpe)</span></div> |
| <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 class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>cpe</code> - URL. |
| The classpath entry to append to the classpath</dd> |
| </dl> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="setClasspath(java.net.URL[])"> |
| <h3>setClasspath</h3> |
| <div class="member-signature"><span class="return-type">void</span> <span class="element-name">setClasspath</span><wbr><span class="parameters">(<a href="https://docs.oracle.com/en/java/javase/18/docs/api/java.base/java/net/URL.html" title="class or interface in java.net" class="external-link" target="_blank">URL</a>[] newClasspath)</span> |
| throws <span class="exceptions"><a href="CannotSetClasspathException.html" title="class in com.ibm.oti.shared">CannotSetClasspathException</a></span></div> |
| <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 class="notes"> |
| <dt>Parameters:</dt> |
| <dd><code>newClasspath</code> - The new URL classpath array</dd> |
| <dt>Throws:</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> |
| </section> |
| </li> |
| <li> |
| <section class="detail" id="confirmAllEntries()"> |
| <h3>confirmAllEntries</h3> |
| <div class="member-signature"><span class="return-type">void</span> <span class="element-name">confirmAllEntries</span>()</div> |
| <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> |
| </section> |
| </li> |
| </ul> |
| </section> |
| </li> |
| </ul> |
| </section> |
| <!-- ========= END OF CLASS DATA ========= --> |
| </main> |
| <footer role="contentinfo"> |
| <hr> |
| <p class="legal-copy"><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, 2022 IBM Corp. and others.</small></p> |
| </footer> |
| </div> |
| </div> |
| </body> |
| </html> |