blob: 4bdfd637dcff39a11ffe07713acac0228ae6cb48 [file] [log] [blame]
<!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 -->
<title>SharedDataHelper (OpenJ9 Shared Classes)</title>
<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">
<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="SharedDataHelper (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/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-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/SharedClassUtilities.html" title="class in com.ibm.oti.shared"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../com/ibm/oti/shared/SharedDataHelperFactory.html" title="interface in com.ibm.oti.shared"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/ibm/oti/shared/SharedDataHelper.html" target="_top">Frames</a></li>
<li><a href="SharedDataHelper.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../allclasses-noframe.html">All&nbsp;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:&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 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 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><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">SharedDataHelper</span>
extends <a href="../../../../com/ibm/oti/shared/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>
<h3>Description</h3>
<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>
<h3>Tokens</h3>
<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>
<h3>Dynamic Cache Updates</h3>
<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>Eg. 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="../../../../com/ibm/oti/shared/SharedHelper.html" title="interface in com.ibm.oti.shared"><code>SharedHelper</code></a>,
<a href="../../../../com/ibm/oti/shared/SharedDataHelperFactory.html" title="interface in com.ibm.oti.shared"><code>SharedDataHelperFactory</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">&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="colLast" scope="col">Method and Description</th>
</tr>
<tr id="i0" class="altColor">
<td class="colFirst"><code><a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" target="_blank" title="class or interface in java.nio">ByteBuffer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/ibm/oti/shared/SharedDataHelper.html#findSharedData-java.lang.String-">findSharedData</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>&nbsp;token)</code>
<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/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" target="_blank" title="class or interface in java.nio">ByteBuffer</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/ibm/oti/shared/SharedDataHelper.html#storeSharedData-java.lang.String-java.nio.ByteBuffer-">storeSharedData</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>&nbsp;token,
<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" target="_blank" title="class or interface in java.nio">ByteBuffer</a>&nbsp;data)</code>
<div class="block">Store data in the shared cache using a specific token.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.com.ibm.oti.shared.SharedHelper">
<!-- -->
</a>
<h3>Methods inherited from interface&nbsp;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="findSharedData-java.lang.String-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>findSharedData</h4>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" target="_blank" title="class or interface in java.nio">ByteBuffer</a>&nbsp;findSharedData(<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>&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.
<p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>token</code> - String.
A String 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 name="storeSharedData-java.lang.String-java.nio.ByteBuffer-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>storeSharedData</h4>
<pre><a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" target="_blank" title="class or interface in java.nio">ByteBuffer</a>&nbsp;storeSharedData(<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>&nbsp;token,
<a href="https://docs.oracle.com/javase/8/docs/api/java/nio/ByteBuffer.html?is-external=true" target="_blank" title="class or interface in java.nio">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 "stale" 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.
<p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>token</code> - String.
A String token to be used as a key</dd>
<dd><code>data</code> - ByteBuffer.
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>
</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/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-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/SharedClassUtilities.html" title="class in com.ibm.oti.shared"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../com/ibm/oti/shared/SharedDataHelperFactory.html" title="interface in com.ibm.oti.shared"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/ibm/oti/shared/SharedDataHelper.html" target="_top">Frames</a></li>
<li><a href="SharedDataHelper.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../allclasses-noframe.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>
</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 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 &copy; 1998, 2020, IBM Corp. and others.</small></p>
</body>
</html>