| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <!-- Generated by javadoc (1.8.0_262-internal) on Thu Jun 04 16:39:21 GMT 2020 --> |
| <title>SharedClassTokenHelper (OpenJ9 Shared Classes)</title> |
| <meta name="date" content="2020-06-04"> |
| <meta name="keywords" content="com.ibm.oti.shared.SharedClassTokenHelper interface"> |
| <meta name="keywords" content="findSharedClass()"> |
| <meta name="keywords" content="storeSharedClass()"> |
| <link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style"> |
| <script type="text/javascript" src="../../../../script.js"></script> |
| </head> |
| <body> |
| <script type="text/javascript"><!-- |
| try { |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="SharedClassTokenHelper (OpenJ9 Shared Classes)"; |
| } |
| } |
| catch(err) { |
| } |
| //--> |
| var methods = {"i0":6,"i1":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"; |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar.top"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.top.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../com/ibm/oti/shared/package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/SharedClassTokenHelper.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-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage"><strong>OpenJ9 Shared Classes</strong></div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../com/ibm/oti/shared/SharedClassStatistics.html" title="class in com.ibm.oti.shared"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../com/ibm/oti/shared/SharedClassURLClasspathHelper.html" title="interface in com.ibm.oti.shared"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?com/ibm/oti/shared/SharedClassTokenHelper.html" target="_top">Frames</a></li> |
| <li><a href="SharedClassTokenHelper.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_top"> |
| <li><a href="../../../../allclasses-noframe.html">All Classes</a></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> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </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 name="skip.navbar.top"> |
| <!-- --> |
| </a></div> |
| <!-- ========= END OF TOP NAVBAR ========= --> |
| <!-- ======== START OF CLASS DATA ======== --> |
| <div class="header"> |
| <div class="subTitle">com.ibm.oti.shared</div> |
| <h2 title="Interface SharedClassTokenHelper" class="title">Interface SharedClassTokenHelper</h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl> |
| <dt>All Superinterfaces:</dt> |
| <dd><a href="../../../../com/ibm/oti/shared/SharedClassHelper.html" title="interface in com.ibm.oti.shared">SharedClassHelper</a>, <a href="../../../../com/ibm/oti/shared/SharedHelper.html" title="interface in com.ibm.oti.shared">SharedHelper</a></dd> |
| </dl> |
| <hr> |
| <br> |
| <pre>public interface <span class="typeNameLabel">SharedClassTokenHelper</span> |
| extends <a href="../../../../com/ibm/oti/shared/SharedClassHelper.html" title="interface in com.ibm.oti.shared">SharedClassHelper</a></pre> |
| <div class="block"><p>SharedClassHelper API that stores and finds classes using String tokens.</p> |
| <h3>Description</h3> |
| <p>A SharedClassTokenHelper is obtained by calling getTokenHelper(ClassLoader) on a SharedClassHelperFactory.</p> |
| <p>The SharedClassTokenHelper, which is the most simple type of helper, uses generated String tokens to find and store classes.</p> |
| <h3>Usage</h3> |
| <p>The ClassLoader should call findSharedClass after looking in its local cache and 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 is responsible for coordinating the creation of token Strings.</p> |
| <h3>Dynamic cache updates.</h3> |
| <p>Because the shared cache persists beyond the lifetime of a JVM, classes in the shared cache can become out of date (stale). |
| Using this helper, it is entirely the responsibility of the ClassLoader to ensure that cache entries are kept up-to-date. |
| Tokens have no meaning to the cache, so effectively turn the it into a dictionary of classes.</p> |
| <p>For example, a token may be the location where the class was found, combined with some type of versioning data.</p> |
| <p>If a ClassLoader stores multiple versions of the same class by using the same token, only the most recent will be returned by findSharedClass. </p> |
| <h3>Security</h3> |
| <p>A SharedClassHelper will only allow classes to be stored in the cache which were defined by the ClassLoader that owns the SharedClassHelper.</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> |
| <h3>Compatibility with other SharedClassHelpers</h3> |
| <p>Classes stored using the SharedClassTokenHelper cannot be retrieved using any other type of helper, and vice versa. </p></div> |
| <dl> |
| <dt><span class="seeLabel">See Also:</span></dt> |
| <dd><a href="../../../../com/ibm/oti/shared/SharedClassHelper.html" title="interface in com.ibm.oti.shared"><code>SharedClassHelper</code></a>, |
| <a href="../../../../com/ibm/oti/shared/SharedClassHelperFactory.html" title="interface in com.ibm.oti.shared"><code>SharedClassHelperFactory</code></a>, |
| <a href="../../../../com/ibm/oti/shared/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"> |
| <!-- ========== METHOD SUMMARY =========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.summary"> |
| <!-- --> |
| </a> |
| <h3>Method Summary</h3> |
| <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <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="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr id="i0" class="altColor"> |
| <td class="colFirst"><code>byte[]</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/ibm/oti/shared/SharedClassTokenHelper.html#findSharedClass-java.lang.String-java.lang.String-">findSharedClass</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" target="_blank" title="class or interface in java.lang">String</a> token, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" target="_blank" title="class or interface in java.lang">String</a> className)</code> |
| <div class="block">Finds a class in the shared cache by using a specific token and class name.</div> |
| </td> |
| </tr> |
| <tr id="i1" class="rowColor"> |
| <td class="colFirst"><code>boolean</code></td> |
| <td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/ibm/oti/shared/SharedClassTokenHelper.html#storeSharedClass-java.lang.String-java.lang.Class-">storeSharedClass</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" target="_blank" title="class or interface in java.lang">String</a> token, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" target="_blank" title="class or interface in java.lang">Class</a><?> clazz)</code> |
| <div class="block">Stores a class in the shared cache by using a specific token.</div> |
| </td> |
| </tr> |
| </table> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.com.ibm.oti.shared.SharedClassHelper"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from interface com.ibm.oti.shared.<a href="../../../../com/ibm/oti/shared/SharedClassHelper.html" title="interface in com.ibm.oti.shared">SharedClassHelper</a></h3> |
| <code><a href="../../../../com/ibm/oti/shared/SharedClassHelper.html#getSharingFilter--">getSharingFilter</a>, <a href="../../../../com/ibm/oti/shared/SharedClassHelper.html#setSharingFilter-com.ibm.oti.shared.SharedClassFilter-">setSharingFilter</a></code></li> |
| </ul> |
| <ul class="blockList"> |
| <li class="blockList"><a name="methods.inherited.from.class.com.ibm.oti.shared.SharedHelper"> |
| <!-- --> |
| </a> |
| <h3>Methods inherited from interface com.ibm.oti.shared.<a href="../../../../com/ibm/oti/shared/SharedHelper.html" title="interface in com.ibm.oti.shared">SharedHelper</a></h3> |
| <code><a href="../../../../com/ibm/oti/shared/SharedHelper.html#getClassLoader--">getClassLoader</a></code></li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| <div class="details"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <!-- ============ METHOD DETAIL ========== --> |
| <ul class="blockList"> |
| <li class="blockList"><a name="method.detail"> |
| <!-- --> |
| </a> |
| <h3>Method Detail</h3> |
| <a name="findSharedClass-java.lang.String-java.lang.String-"> |
| <!-- --> |
| </a> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <h4>findSharedClass</h4> |
| <pre>byte[] findSharedClass(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" target="_blank" title="class or interface in java.lang">String</a> token, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" target="_blank" title="class or interface in java.lang">String</a> className)</pre> |
| <div class="block">Finds a class in the shared cache by using a specific token and class name.<p> |
| A class will be returned only for an exact String match of both the token and class name. |
| Otherwise, null is returned.<br> |
| To obtain an instance of the class, the byte[] returned must be passed to defineClass by the caller ClassLoader. |
| <p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>token</code> - String. |
| A token generated by the ClassLoader</dd> |
| <dd><code>className</code> - String. |
| The name of the class to be found</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>byte[]. |
| A byte array describing the class found, or null.</dd> |
| </dl> |
| </li> |
| </ul> |
| <a name="storeSharedClass-java.lang.String-java.lang.Class-"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>storeSharedClass</h4> |
| <pre>boolean storeSharedClass(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/String.html?is-external=true" target="_blank" title="class or interface in java.lang">String</a> token, |
| <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Class.html?is-external=true" target="_blank" title="class or interface in java.lang">Class</a><?> clazz)</pre> |
| <div class="block">Stores a class in the shared cache by using a specific token.<p> |
| The class that is being stored must have been defined by the caller ClassLoader.<br> |
| Returns <code>true</code> if the class is stored successfully or false otherwise.<br> |
| Will return <code>false</code> if the class that is being stored was not defined by the caller ClassLoader. |
| <p></div> |
| <dl> |
| <dt><span class="paramLabel">Parameters:</span></dt> |
| <dd><code>token</code> - String. |
| A token generated by the ClassLoader</dd> |
| <dd><code>clazz</code> - Class. |
| The class to store in the shared cache</dd> |
| <dt><span class="returnLabel">Returns:</span></dt> |
| <dd>boolean. |
| True if the class was stored successfully, false otherwise.</dd> |
| </dl> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </li> |
| </ul> |
| </div> |
| </div> |
| <!-- ========= END OF CLASS DATA ========= --> |
| <!-- ======= START OF BOTTOM NAVBAR ====== --> |
| <div class="bottomNav"><a name="navbar.bottom"> |
| <!-- --> |
| </a> |
| <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> |
| <a name="navbar.bottom.firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../../com/ibm/oti/shared/package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/SharedClassTokenHelper.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-all.html">Index</a></li> |
| <li><a href="../../../../help-doc.html">Help</a></li> |
| </ul> |
| <div class="aboutLanguage"><strong>OpenJ9 Shared Classes</strong></div> |
| </div> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li><a href="../../../../com/ibm/oti/shared/SharedClassStatistics.html" title="class in com.ibm.oti.shared"><span class="typeNameLink">Prev Class</span></a></li> |
| <li><a href="../../../../com/ibm/oti/shared/SharedClassURLClasspathHelper.html" title="interface in com.ibm.oti.shared"><span class="typeNameLink">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../../index.html?com/ibm/oti/shared/SharedClassTokenHelper.html" target="_top">Frames</a></li> |
| <li><a href="SharedClassTokenHelper.html" target="_top">No Frames</a></li> |
| </ul> |
| <ul class="navList" id="allclasses_navbar_bottom"> |
| <li><a href="../../../../allclasses-noframe.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> |
| </div> |
| <div> |
| <ul class="subNavList"> |
| <li>Summary: </li> |
| <li>Nested | </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 name="skip.navbar.bottom"> |
| <!-- --> |
| </a></div> |
| <!-- ======== END OF BOTTOM NAVBAR ======= --> |
| <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/issues" target="_blank">Eclipse OpenJ9 issue.</a><br> Copyright © 1998, 2020, IBM Corp. and others.</small></p> |
| </body> |
| </html> |