blob: 947cdaecd8ab1031b7e93347d022aa327726bc14 [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 (1.8.0) on Sun Aug 28 20:42:46 EST 2016 -->
<title>MailboxImpl.LocalLogHandler (Apache River v3.0.0 API Documentation (internals))</title>
<meta name="date" content="2016-08-28">
<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="MailboxImpl.LocalLogHandler (Apache River v3.0.0 API Documentation (internals))";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10};
var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete 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="../../../../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/MailboxImpl.LocalLogHandler.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><a href="../../../../org/apache/river/mercury/MailboxImpl.LocalLandlordAdaptor.html" title="class in org.apache.river.mercury"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/apache/river/mercury/MailboxImpl.LogRecord.html" title="interface in org.apache.river.mercury"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/river/mercury/MailboxImpl.LocalLogHandler.html" target="_top">Frames</a></li>
<li><a href="MailboxImpl.LocalLogHandler.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><a href="#constructor.summary">Constr</a>&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><a href="#constructor.detail">Constr</a>&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">org.apache.river.mercury</div>
<h2 title="Class MailboxImpl.LocalLogHandler" class="title">Class MailboxImpl.LocalLogHandler</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li>
<li>
<ul class="inheritance">
<li><a href="../../../../org/apache/river/reliableLog/LogHandler.html" title="class in org.apache.river.reliableLog">org.apache.river.reliableLog.LogHandler</a></li>
<li>
<ul class="inheritance">
<li>org.apache.river.mercury.MailboxImpl.LocalLogHandler</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>Enclosing class:</dt>
<dd><a href="../../../../org/apache/river/mercury/MailboxImpl.html" title="class in org.apache.river.mercury">MailboxImpl</a></dd>
</dl>
<hr>
<br>
<pre>private class <span class="typeNameLabel">MailboxImpl.LocalLogHandler</span>
extends <a href="../../../../org/apache/river/reliableLog/LogHandler.html" title="class in org.apache.river.reliableLog">LogHandler</a></pre>
<div class="block">Handler class for the persistent storage facility.
<p>
At any point during processing in the mailbox, there will exist
both a 'snapshot' of the mailbox's state and a set of records
detailing each significant change that has occurred to the state
since the snapshot was taken. The snapshot information and the
incremental change information will be stored in separate files
called, respectively, the snapshot file and the log file. Together,
these files are used to recover the state of the mailbox after a
crash or a network outage (or if the mailbox or its ActivationGroup
is un-registered and then re-registered through the activation daemon).
<p>
This class contains the methods that are used to record and recover
the snapshot of the mailbox's state; as well as the method used to
apply the state changes that were recorded in the log file.
<p>
When the ReliableLog class is instantiated, a new instance of this
class is passed to its constructor so that the methods of this
class may be invoked by the methods defined in the ReliableLog.
Because this class extends the LogHandler class associated with
the ReliableLog class, this class must provide implementations of
the abstract methods declared in the LogHandler. Also, some of the
methods defined in this class override the methods of the LogHandler
in order to customize the handling of snapshot creation and
retrieval.
<p>
Each significant change to the mailbox's state is written to the
log file as an individual record (when addLogRecord() is invoked).
After the number of records logged exceeds a pre-defined threshold,
a snapshot of the state is recorded by invoking -- through the
ReliableLog and its LogHandler -- the snapshot() method defined in
this class. After the snapshot is taken, the log file is cleared
and the incremental log process starts over.
<p>
The contents of the snapshot file reflect the DATA contained in
the fields making up the current state of the mailbox. That data
represents many changes -- over time -- to the mailbox's state.
On the other hand, each record written to the log file is an object
that reflects both the data used and the ACTIONS taken to make one
change to the mailbox's state at a particular point in time.
<p>
During recovery, the state of the mailbox at the time of a crash
or outage is re-constructed by first retrieving the 'base' state from
the snapshot file; and then modifying that base state according to
the records retrieved from the log file. The reconstruction of the
base state is achieved by invoking the recover() method defined in
this class. The modifications recorded in the log file are then
applied to the base state by invoking the applyUpdate() method
defined in this class. Both recover() and applyUpdate() are invoked
through the ReliableLog and its associated LogHandler.
<p>
NOTE: The following lines must be added to the mailbox's policy file
<pre>
permission java.io.FilePermission "dirname", "read,write,delete";
permission java.io.FilePermission "dirname/-", "read,write,delete";
</pre>
where 'dirname' is the name of the directory path (relative or
absolute) where the snapshot and log file will be maintained.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.summary">
<!-- -->
</a>
<h3>Constructor Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation">
<caption><span>Constructors</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colOne" scope="col">Constructor and Description</th>
</tr>
<tr class="altColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../org/apache/river/mercury/MailboxImpl.LocalLogHandler.html#LocalLogHandler--">LocalLogHandler</a></span>()</code>
<div class="block">Simple constructor</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ========== 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="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete 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>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/river/mercury/MailboxImpl.LocalLogHandler.html#applyUpdate-java.lang.Object-">applyUpdate</a></span>(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;logRecObj)</code>
<div class="block">Required method implementing the abstract applyUpdate()
defined in ReliableLog's associated LogHandler class.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/river/mercury/MailboxImpl.LocalLogHandler.html#recover-java.io.InputStream-">recover</a></span>(<a href="http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;in)</code>
<div class="block">Read the snapshot from a stream.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../org/apache/river/mercury/MailboxImpl.LocalLogHandler.html#snapshot-java.io.OutputStream-">snapshot</a></span>(<a href="http://docs.oracle.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a>&nbsp;out)</code>
<div class="block">Writes the snapshot to a stream.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.org.apache.river.reliableLog.LogHandler">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;org.apache.river.reliableLog.<a href="../../../../org/apache/river/reliableLog/LogHandler.html" title="class in org.apache.river.reliableLog">LogHandler</a></h3>
<code><a href="../../../../org/apache/river/reliableLog/LogHandler.html#readUpdate-java.io.InputStream-">readUpdate</a>, <a href="../../../../org/apache/river/reliableLog/LogHandler.html#writeUpdate-java.io.OutputStream-java.lang.Object-">writeUpdate</a></code></li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3>
<code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="LocalLogHandler--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>LocalLogHandler</h4>
<pre>public&nbsp;LocalLogHandler()</pre>
<div class="block">Simple constructor</div>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="snapshot-java.io.OutputStream-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>snapshot</h4>
<pre>public&nbsp;void&nbsp;snapshot(<a href="http://docs.oracle.com/javase/6/docs/api/java/io/OutputStream.html?is-external=true" title="class or interface in java.io">OutputStream</a>&nbsp;out)
throws <a href="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../../org/apache/river/reliableLog/LogHandler.html#snapshot-java.io.OutputStream-">LogHandler</a></code></span></div>
<div class="block">Writes the snapshot to a stream. This callback is invoked when
the client calls the snaphot method of ReliableLog.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../org/apache/river/reliableLog/LogHandler.html#snapshot-java.io.OutputStream-">snapshot</a></code>&nbsp;in class&nbsp;<code><a href="../../../../org/apache/river/reliableLog/LogHandler.html" title="class in org.apache.river.reliableLog">LogHandler</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>out</code> - the output stream</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
</dl>
</li>
</ul>
<a name="recover-java.io.InputStream-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>recover</h4>
<pre>public&nbsp;void&nbsp;recover(<a href="http://docs.oracle.com/javase/6/docs/api/java/io/InputStream.html?is-external=true" title="class or interface in java.io">InputStream</a>&nbsp;in)
throws <a href="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a>,
<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/ClassNotFoundException.html?is-external=true" title="class or interface in java.lang">ClassNotFoundException</a></pre>
<div class="block"><span class="descfrmTypeLabel">Description copied from class:&nbsp;<code><a href="../../../../org/apache/river/reliableLog/LogHandler.html#recover-java.io.InputStream-">LogHandler</a></code></span></div>
<div class="block">Read the snapshot from a stream. This callback is invoked when
the client calls the recover method of ReliableLog.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../org/apache/river/reliableLog/LogHandler.html#recover-java.io.InputStream-">recover</a></code>&nbsp;in class&nbsp;<code><a href="../../../../org/apache/river/reliableLog/LogHandler.html" title="class in org.apache.river.reliableLog">LogHandler</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>in</code> - the input stream</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/io/IOException.html?is-external=true" title="class or interface in java.io">IOException</a></code></dd>
<dd><code><a href="http://docs.oracle.com/javase/6/docs/api/java/lang/ClassNotFoundException.html?is-external=true" title="class or interface in java.lang">ClassNotFoundException</a></code></dd>
</dl>
</li>
</ul>
<a name="applyUpdate-java.lang.Object-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>applyUpdate</h4>
<pre>public&nbsp;void&nbsp;applyUpdate(<a href="http://docs.oracle.com/javase/6/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;logRecObj)</pre>
<div class="block">Required method implementing the abstract applyUpdate()
defined in ReliableLog's associated LogHandler class.
<p>
During state recovery, the recover() method defined in the
ReliableLog class is invoked. That method invokes the method
recoverUpdates() which invokes the method readUpdates(). Both
of those methods are defined in ReliableLog. The method
readUpdates() retrieves a record from the log file and then
invokes this method.
<p>
This method invokes the version of the method apply() that
corresponds to the particular type of 'log record' object
that is input as the first argument. The log record object and its
corresponding apply() method are defined in one of the so-called
LogObj classes. Any instance of one the LogObj classes is an
implementation of the LogRecord interface. The particular
implementation that is input to this method is dependent on the
type of record that was originally logged. The apply() method
will then modify the state of the mailbox in a way dictated
by the type of record that was retrieved.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code><a href="../../../../org/apache/river/reliableLog/LogHandler.html#applyUpdate-java.lang.Object-">applyUpdate</a></code>&nbsp;in class&nbsp;<code><a href="../../../../org/apache/river/reliableLog/LogHandler.html" title="class in org.apache.river.reliableLog">LogHandler</a></code></dd>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>logRecObj</code> - the update object</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="../../../../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/MailboxImpl.LocalLogHandler.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><a href="../../../../org/apache/river/mercury/MailboxImpl.LocalLandlordAdaptor.html" title="class in org.apache.river.mercury"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../org/apache/river/mercury/MailboxImpl.LogRecord.html" title="interface in org.apache.river.mercury"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?org/apache/river/mercury/MailboxImpl.LocalLogHandler.html" target="_top">Frames</a></li>
<li><a href="MailboxImpl.LocalLogHandler.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><a href="#constructor.summary">Constr</a>&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><a href="#constructor.detail">Constr</a>&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>Copyright 2007-2013, multiple authors.<br>Licensed under the <a href=http://www.apache.org/licenses/LICENSE-2.0 target=child >Apache License, Version 2.0</a>, see the <a href=../../../../doc-files/NOTICE target=child >NOTICE</a> file for attributions.</small></p>
</body>
</html>