blob: 7c7de215c0128e7f70d8666018c2064a75b02559 [file] [log] [blame]
<!DOCTYPE HTML>
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc -->
<title>SharedDataHelper (OpenJ9 JDK 11)</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="keywords" content="com.ibm.oti.shared.SharedDataHelper interface">
<meta name="keywords" content="findSharedData()">
<meta name="keywords" content="storeSharedData()">
<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="SharedDataHelper (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/SharedDataHelper.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 SharedDataHelper" class="title">Interface SharedDataHelper</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><code><a href="SharedHelper.html" title="interface in com.ibm.oti.shared">SharedHelper</a></code></dd>
</dl>
<hr>
<pre>public interface <span class="typeNameLabel">SharedDataHelper</span>
extends <a href="SharedHelper.html" title="interface in com.ibm.oti.shared">SharedHelper</a></pre>
<div class="block"><p>SharedDataHelper API that stores and finds byte data using String tokens.</p>
<h2>Description</h2>
<p>A SharedDataHelper is obtained by calling getSharedDataHelper(ClassLoader) on a SharedDataHelperFactory.</p>
<p>The SharedDataHelper allows byte data to be written into the shared class cache and shared with other VMs.</p>
<p>Byte data to be stored in the cache should exist in a java.nio.ByteBuffer which is copied to the cache when
storeSharedData() is called. The function returns a read-only java.nio.ByteBuffer which is the shared copy of the data.
Any subsequent changes to the ByteBuffer are therefore not reflected in the cache unless it is re-stored.</p>
<p>Byte data is found in the cache by calling findSharedData() which returns a read-only java.nio.ByteBuffer which
maps to the byte data that exists in the cache.</p>
<h2>Tokens</h2>
<p>A String token is chosen/generated by the application which is using the Helper and should ideally include a unique
identifier and some kind of versioning information. Eg. com.foo.myApp31_myDoozerData_003. The important factor is that
other VMs running the same application should be able to apply the same algorithm and find the data. </p>
<h2>Dynamic Cache Updates</h2>
<p>Since the shared cache is persistent beyond the lifetime of a JVM, data in the shared cache may become out-of-date (<q>stale</q>).
Using this helper, it is entirely the responsibility of the application to ensure that cache entries are kept up-to-date.
Tokens have no meaning to the cache, so effectively turn it into a dictionary of classes.</p>
<p>E.g. A token may be the location where the class was found, combined with some type of versioning data.</p>
<p>If an application stores multiple versions of the same data using the same token, only the most recent will be returned by findSharedData.</p></div>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="SharedHelper.html" title="interface in com.ibm.oti.shared"><code>SharedHelper</code></a>,
<a href="SharedDataHelperFactory.html" title="interface in com.ibm.oti.shared"><code>SharedDataHelperFactory</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><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio" class="externalLink" target="_blank">ByteBuffer</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#findSharedData(java.lang.String)">findSharedData</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)</code></th>
<td class="colLast">
<div class="block">Find data in the shared cache using a specific token.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio" class="externalLink" target="_blank">ByteBuffer</a></code></td>
<th class="colSecond" scope="row"><code><span class="memberNameLink"><a href="#storeSharedData(java.lang.String,java.nio.ByteBuffer)">storeSharedData</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/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio" class="externalLink" target="_blank">ByteBuffer</a>&nbsp;data)</code></th>
<td class="colLast">
<div class="block">Store data in the shared cache using a specific token.</div>
</td>
</tr>
</table>
<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="findSharedData(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>findSharedData</h4>
<pre class="methodSignature"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio" class="externalLink" target="_blank">ByteBuffer</a>&nbsp;findSharedData&#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)</pre>
<div class="block">Find data in the shared cache using a specific token.<p>
Data will be returned only for an exact String match of the token. Otherwise, null is returned.<br>
The ByteBuffer returned is read-only and cannot be modified.<br>
If a SecurityManager is installed, findSharedData can only be called by code whose caller-classloader
has been granted <q>read</q> permissions to the shared class cache.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>token</code> - a token to be used as a key</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>ByteBuffer a read-only ByteBuffer containing the cached data, or null</dd>
</dl>
</li>
</ul>
<a id="storeSharedData(java.lang.String,java.nio.ByteBuffer)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>storeSharedData</h4>
<pre class="methodSignature"><a href="https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio" class="externalLink" target="_blank">ByteBuffer</a>&nbsp;storeSharedData&#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/nio/ByteBuffer.html?is-external=true" title="class or interface in java.nio" class="externalLink" target="_blank">ByteBuffer</a>&nbsp;data)</pre>
<div class="block">Store data in the shared cache using a specific token.<p>
If the data is stored successfully, the shared read-only copy of the data is returned. Otherwise, null is returned.<br>
If data already exists for the token specified, the old data is marked <q>stale</q> in the cache and is replaced by the new data.<br>
If the exact same data already exists in the cache under the same token, the data is not duplicated and the cached version is returned.<br>
If null is passed as the data argument, the data currently stored against that token is marked <q>stale</q> and null is returned.<br>
If a SecurityManager is installed, storeSharedData can only be called by code whose caller-classloader
has been granted <q>write</q> permissions to the shared class cache.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>token</code> - a token to be used as a key</dd>
<dd><code>data</code> - a ByteBuffer of data to copy to the cache</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>ByteBuffer a read-only ByteBuffer containing the cached data, or null</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/SharedDataHelper.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, 2022 IBM Corp. and others.</small></p>
</footer>
</body>
</html>