blob: 3434f56328a7b69a982fac4aa1ad4ffb7e5e7030 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>SharedClassTokenHelper (OpenJ9 JDK 11)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<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">
<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="SharedClassTokenHelper (OpenJ9 JDK 11)";
}
}
catch(err) {
}
//-->
var data = {"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";
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/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-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&nbsp;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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</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">&nbsp;</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>&nbsp;<a href="../../../../module-summary.html">openj9.sharedclasses</a></div>
<div class="subTitle"><span class="packageLabelInType">Package</span>&nbsp;<a href="package-summary.html">com.ibm.oti.shared</a></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><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">SharedClassTokenHelper</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 using String tokens.</p>
<h2>Description</h2>
<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>
<h2>Usage</h2>
<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>
<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).
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>
<h2>Security</h2>
<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>
<h2>Compatibility with other SharedClassHelpers</h2>
<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="SharedClassHelper.html" title="interface in com.ibm.oti.shared"><code>SharedClassHelper</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">
<!-- ========== 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">&nbsp;</span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd">&nbsp;</span></span><span id="t3" class="tableTab"><span><a href="javascript:show(4);">Abstract Methods</a></span><span class="tabEnd">&nbsp;</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>byte[]</code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#findSharedClass(java.lang.String,java.lang.String)">findSharedClass</a></span>&#8203;(<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>&nbsp;token,
<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>&nbsp;className)</code></th>
<td class="colLast">
<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>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#storeSharedClass(java.lang.String,java.lang.Class)">storeSharedClass</a></span>&#8203;(<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>&nbsp;token,
<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>&lt;?&gt;&nbsp;clazz)</code></th>
<td class="colLast">
<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 id="methods.inherited.from.class.com.ibm.oti.shared.SharedClassHelper">
<!-- -->
</a>
<h3>Methods declared in interface&nbsp;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&nbsp;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,java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>findSharedClass</h4>
<pre class="methodSignature">byte[]&nbsp;findSharedClass&#8203;(<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>&nbsp;token,
<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>&nbsp;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 id="storeSharedClass(java.lang.String,java.lang.Class)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>storeSharedClass</h4>
<pre class="methodSignature">boolean&nbsp;storeSharedClass&#8203;(<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>&nbsp;token,
<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>&lt;?&gt;&nbsp;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>
</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/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-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&nbsp;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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method.summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</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 &copy; 1998, 2021, IBM Corp. and others.</small></p>
</footer>
</body>
</html>