| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> |
| <!-- NewPage --> |
| <html lang="en"> |
| <head> |
| <link rel="canonical" href="https://ignite.apache.org/jcache/1.0.0/javadoc/javax/cache/processor/EntryProcessor.html" /> |
| <!-- Generated by javadoc (version 1.7.0_25) on Fri Mar 28 13:34:25 EST 2014 --> |
| <meta http-equiv="Content-Type" content="text/html" charset="UTF-8"> |
| <title>EntryProcessor (JSR107 API and SPI 1.0.0 API)</title> |
| <meta name="date" content="2014-03-28"> |
| <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> |
| |
| <script> |
| (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ |
| (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), |
| m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) |
| })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); |
| |
| ga('create', 'UA-61232409-1', 'auto'); |
| ga('send', 'pageview'); |
| |
| </script></head> |
| <body> |
| <script type="text/javascript"><!-- |
| if (location.href.indexOf('is-external=true') == -1) { |
| parent.document.title="EntryProcessor (JSR107 API and SPI 1.0.0 API)"; |
| } |
| //--> |
| </script> |
| <noscript> |
| <div>JavaScript is disabled on your browser.</div> |
| </noscript> |
| <!-- ========= START OF TOP NAVBAR ======= --> |
| <div class="topNav"><a name="navbar_top"> |
| <!-- --> |
| </a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/EntryProcessor.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> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li>Prev Class</li> |
| <li><a href="../../../javax/cache/processor/EntryProcessorException.html" title="class in javax.cache.processor"><span class="strong">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../index.html?javax/cache/processor/EntryProcessor.html" target="_top">Frames</a></li> |
| <li><a href="EntryProcessor.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">javax.cache.processor</div> |
| <h2 title="Interface EntryProcessor" class="title">Interface EntryProcessor<K,V,T></h2> |
| </div> |
| <div class="contentContainer"> |
| <div class="description"> |
| <ul class="blockList"> |
| <li class="blockList"> |
| <dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>K</code> - the type of keys maintained by this cache</dd><dd><code>V</code> - the type of cached values</dd><dd><code>T</code> - the type of the return value</dd></dl> |
| <hr> |
| <br> |
| <pre>public interface <span class="strong">EntryProcessor<K,V,T></span></pre> |
| <div class="block">An invocable function that allows applications to perform compound operations |
| on a <a href="../../../javax/cache/Cache.Entry.html" title="interface in javax.cache"><code>Cache.Entry</code></a> atomically, according the defined |
| consistency of a <a href="../../../javax/cache/Cache.html" title="interface in javax.cache"><code>Cache</code></a>. |
| <p> |
| Any <a href="../../../javax/cache/Cache.Entry.html" title="interface in javax.cache"><code>Cache.Entry</code></a> mutations will not take effect until after |
| the <a href="../../../javax/cache/processor/EntryProcessor.html#process(javax.cache.processor.MutableEntry, java.lang.Object...)"><code>process(MutableEntry, Object...)</code></a> method has completed |
| execution. |
| <p> |
| If an exception is thrown by an <a href="../../../javax/cache/processor/EntryProcessor.html" title="interface in javax.cache.processor"><code>EntryProcessor</code></a>, a Caching Implementation |
| must wrap any <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Exception.html?is-external=true" title="class or interface in java.lang"><code>Exception</code></a> thrown wrapped in an <a href="../../../javax/cache/processor/EntryProcessorException.html" title="class in javax.cache.processor"><code>EntryProcessorException</code></a>. If this occurs no mutations will be made to the |
| <a href="../../../javax/cache/Cache.Entry.html" title="interface in javax.cache"><code>Cache.Entry</code></a>. |
| <p> |
| Implementations may execute <a href="../../../javax/cache/processor/EntryProcessor.html" title="interface in javax.cache.processor"><code>EntryProcessor</code></a>s in situ, thus avoiding |
| locking, round-trips and expensive network transfers. |
| |
| <h3>Effect of <a href="../../../javax/cache/processor/MutableEntry.html" title="interface in javax.cache.processor"><code>MutableEntry</code></a> operations</h3> |
| <a href="../../../javax/cache/Cache.Entry.html" title="interface in javax.cache"><code>Cache.Entry</code></a> access, via a call to |
| <a href="../../../javax/cache/Cache.Entry.html#getValue()"><code>Cache.Entry.getValue()</code></a>, will behave as if |
| <a href="../../../javax/cache/Cache.html#get(K)"><code>Cache.get(Object)</code></a> was called for the key. This includes updating |
| necessary statistics, consulting the configured <a href="../../../javax/cache/expiry/ExpiryPolicy.html" title="interface in javax.cache.expiry"><code>ExpiryPolicy</code></a> and loading |
| from a configured <a href="../../../javax/cache/integration/CacheLoader.html" title="interface in javax.cache.integration"><code>CacheLoader</code></a>. |
| <p> |
| <a href="../../../javax/cache/Cache.Entry.html" title="interface in javax.cache"><code>Cache.Entry</code></a> mutation, via a call to |
| <a href="../../../javax/cache/processor/MutableEntry.html#setValue(V)"><code>MutableEntry.setValue(Object)</code></a>, will behave as if <a href="../../../javax/cache/Cache.html#put(K, V)"><code>Cache.put(Object, Object)</code></a> was called for the key. This includes updating |
| necessary statistics, consulting the configured <a href="../../../javax/cache/expiry/ExpiryPolicy.html" title="interface in javax.cache.expiry"><code>ExpiryPolicy</code></a>, notifying <a href="../../../javax/cache/event/CacheEntryListener.html" title="interface in javax.cache.event"><code>CacheEntryListener</code></a>s and writing to a |
| configured <a href="../../../javax/cache/integration/CacheWriter.html" title="interface in javax.cache.integration"><code>CacheWriter</code></a>. |
| <p> |
| <a href="../../../javax/cache/Cache.Entry.html" title="interface in javax.cache"><code>Cache.Entry</code></a> removal, via a call to |
| <a href="../../../javax/cache/processor/MutableEntry.html#remove()"><code>MutableEntry.remove()</code></a>, will behave as if <a href="../../../javax/cache/Cache.html#remove(K)"><code>Cache.remove(Object)</code></a> |
| was called for the key. This includes updating necessary statistics, notifying |
| <a href="../../../javax/cache/event/CacheEntryListener.html" title="interface in javax.cache.event"><code>CacheEntryListener</code></a>s and causing a delete on a configured |
| <a href="../../../javax/cache/integration/CacheWriter.html" title="interface in javax.cache.integration"><code>CacheWriter</code></a>. |
| <p> |
| As implementations may choose to execute <a href="../../../javax/cache/processor/EntryProcessor.html" title="interface in javax.cache.processor"><code>EntryProcessor</code></a>s remotely, |
| <a href="../../../javax/cache/processor/EntryProcessor.html" title="interface in javax.cache.processor"><code>EntryProcessor</code></a>s, together with specified parameters and return |
| values, may be required to implement <a href="http://download.oracle.com/javase/6/docs/api/java/io/Serializable.html?is-external=true" title="class or interface in java.io"><code>Serializable</code></a>. |
| |
| <h3>Effect of multiple <a href="../../../javax/cache/processor/MutableEntry.html" title="interface in javax.cache.processor"><code>MutableEntry</code></a> operations performed by one <a href="../../../javax/cache/processor/EntryProcessor.html" title="interface in javax.cache.processor"><code>EntryProcessor</code></a></h3> |
| Only the net effect of multiple operations has visibility outside of the Entry |
| Processor. The entry is locked by the entry processor for the entire scope |
| of the entry processor, so intermediate effects are not visible. |
| <h4>Example 1</h4> |
| In this example, an <a href="../../../javax/cache/processor/EntryProcessor.html" title="interface in javax.cache.processor"><code>EntryProcessor</code></a> calls: |
| <ol> |
| <li><a href="../../../javax/cache/Cache.Entry.html#getValue()"><code>Cache.Entry.getValue()</code></a></li> |
| <li><a href="../../../javax/cache/processor/MutableEntry.html#setValue(V)"><code>MutableEntry.setValue(Object)</code></a></li> |
| <li><a href="../../../javax/cache/Cache.Entry.html#getValue()"><code>Cache.Entry.getValue()</code></a></li> |
| <li><a href="../../../javax/cache/processor/MutableEntry.html#setValue(V)"><code>MutableEntry.setValue(Object)</code></a></li> |
| </ol> |
| This will have the following <a href="../../../javax/cache/Cache.html" title="interface in javax.cache"><code>Cache</code></a> effects: |
| <br> |
| Final value of the cache: last setValue<br> |
| Statistics: one get and one put as the second get and the first put are |
| internal to the EntryProcessor.<br> |
| Listeners: second put will cause either a put or an update depending on whether |
| there was an initial value for the entry.<br> |
| CacheLoader: Invoked by the first get only if a loader was registered.<br> |
| CacheWriter: Invoked by the second put only as the first put was internal to |
| the Entry Processor.<br> |
| ExpiryPolicy: The first get and the second put only are visible to the |
| ExpiryPolicy.<br> |
| |
| <h4>Example 2</h4> |
| In this example, an <a href="../../../javax/cache/processor/EntryProcessor.html" title="interface in javax.cache.processor"><code>EntryProcessor</code></a> calls: |
| <ol> |
| <li><a href="../../../javax/cache/Cache.Entry.html#getValue()"><code>Cache.Entry.getValue()</code></a></li> |
| <li><a href="../../../javax/cache/processor/MutableEntry.html#remove()"><code>MutableEntry.remove()</code></a>}</li> |
| <li><a href="../../../javax/cache/Cache.Entry.html#getValue()"><code>Cache.Entry.getValue()</code></a></li> |
| <li><a href="../../../javax/cache/processor/MutableEntry.html#setValue(V)"><code>MutableEntry.setValue(Object)</code></a></li> |
| </ol> |
| This will have the following <a href="../../../javax/cache/Cache.html" title="interface in javax.cache"><code>Cache</code></a> effects: |
| <br> |
| Final value of the cache: last setValue<br> |
| Statistics: one get and one put as the second get and the first put are |
| internal to the EntryProcessor.<br> |
| Listeners: second put will cause either a put or an update depending on whether |
| there was an initial value for the entry.<br> |
| CacheLoader: Invoked by the first get only if a loader was registered.<br> |
| CacheWriter: Invoked by the second put only as the first put was internal to |
| the Entry Processor.<br> |
| ExpiryPolicy: The first get and the second put only are visible to the |
| ExpiryPolicy.<br> |
| |
| <h4>Example 3</h4> |
| In this example, an <a href="../../../javax/cache/processor/EntryProcessor.html" title="interface in javax.cache.processor"><code>EntryProcessor</code></a> calls: |
| <ol> |
| <li><a href="../../../javax/cache/Cache.Entry.html#getValue()"><code>Cache.Entry.getValue()</code></a></li> |
| <li><a href="../../../javax/cache/processor/MutableEntry.html#setValue(V)"><code>MutableEntry.setValue(Object)</code></a>}</li> |
| <li><a href="../../../javax/cache/Cache.Entry.html#getValue()"><code>Cache.Entry.getValue()</code></a></li> |
| <li><a href="../../../javax/cache/processor/MutableEntry.html#setValue(V)"><code>MutableEntry.setValue(Object)</code></a></li> |
| <li><a href="../../../javax/cache/processor/MutableEntry.html#remove()"><code>MutableEntry.remove()</code></a></li> |
| </ol> |
| This will have the following <a href="../../../javax/cache/Cache.html" title="interface in javax.cache"><code>Cache</code></a> effects: |
| <br> |
| Final value of the cache: last setValue<br> |
| Statistics: one get and one remove as the second get and the two puts are |
| internal to the EntryProcessor.<br> |
| Listeners: remove if there was initial value in the cache, otherwise no |
| listener invoked. |
| <br> CacheLoader: Invoked by the first get only if a loader was |
| registered. |
| <br> CacheWriter: Invoked by the remove only as the two puts are internal to |
| the Entry Processor.<br> |
| ExpiryPolicy: The first get only is visible to the ExpiryPolicy. There is no |
| remove event in ExpiryPolicy.</div> |
| <dl><dt><span class="strong">Since:</span></dt> |
| <dd>1.0</dd> |
| <dt><span class="strong">Author:</span></dt> |
| <dd>Greg Luck</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="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> |
| <caption><span>Methods</span><span class="tabEnd"> </span></caption> |
| <tr> |
| <th class="colFirst" scope="col">Modifier and Type</th> |
| <th class="colLast" scope="col">Method and Description</th> |
| </tr> |
| <tr class="altColor"> |
| <td class="colFirst"><code><a href="../../../javax/cache/processor/EntryProcessor.html" title="type parameter in EntryProcessor">T</a></code></td> |
| <td class="colLast"><code><strong><a href="../../../javax/cache/processor/EntryProcessor.html#process(javax.cache.processor.MutableEntry, java.lang.Object...)">process</a></strong>(<a href="../../../javax/cache/processor/MutableEntry.html" title="interface in javax.cache.processor">MutableEntry</a><<a href="../../../javax/cache/processor/EntryProcessor.html" title="type parameter in EntryProcessor">K</a>,<a href="../../../javax/cache/processor/EntryProcessor.html" title="type parameter in EntryProcessor">V</a>> entry, |
| <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>... arguments)</code> |
| <div class="block">Process an entry.</div> |
| </td> |
| </tr> |
| </table> |
| </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="process(javax.cache.processor.MutableEntry, java.lang.Object...)"> |
| <!-- --> |
| </a> |
| <ul class="blockListLast"> |
| <li class="blockList"> |
| <h4>process</h4> |
| <pre><a href="../../../javax/cache/processor/EntryProcessor.html" title="type parameter in EntryProcessor">T</a> process(<a href="../../../javax/cache/processor/MutableEntry.html" title="interface in javax.cache.processor">MutableEntry</a><<a href="../../../javax/cache/processor/EntryProcessor.html" title="type parameter in EntryProcessor">K</a>,<a href="../../../javax/cache/processor/EntryProcessor.html" title="type parameter in EntryProcessor">V</a>> entry, |
| <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>... arguments) |
| throws <a href="../../../javax/cache/processor/EntryProcessorException.html" title="class in javax.cache.processor">EntryProcessorException</a></pre> |
| <div class="block">Process an entry.</div> |
| <dl><dt><span class="strong">Parameters:</span></dt><dd><code>entry</code> - the entry</dd><dd><code>arguments</code> - a number of arguments to the process.</dd> |
| <dt><span class="strong">Returns:</span></dt><dd>the user-defined result of the processing, if any.</dd> |
| <dt><span class="strong">Throws:</span></dt> |
| <dd><code><a href="../../../javax/cache/processor/EntryProcessorException.html" title="class in javax.cache.processor">EntryProcessorException</a></code> - if there is a failure in entry processing.</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><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow"> |
| <!-- --> |
| </a> |
| <ul class="navList" title="Navigation"> |
| <li><a href="../../../overview-summary.html">Overview</a></li> |
| <li><a href="package-summary.html">Package</a></li> |
| <li class="navBarCell1Rev">Class</li> |
| <li><a href="class-use/EntryProcessor.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> |
| <div class="subNav"> |
| <ul class="navList"> |
| <li>Prev Class</li> |
| <li><a href="../../../javax/cache/processor/EntryProcessorException.html" title="class in javax.cache.processor"><span class="strong">Next Class</span></a></li> |
| </ul> |
| <ul class="navList"> |
| <li><a href="../../../index.html?javax/cache/processor/EntryProcessor.html" target="_top">Frames</a></li> |
| <li><a href="EntryProcessor.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>Copyright © 2014. All Rights Reserved.</small></p> |
| </body> |
| </html> |