stasis/je-7.5.11/docs/examples/je/rep/quote/StockQuotesRMIForwarding.html

376 lines
15 KiB
HTML
Raw Permalink Normal View History

2019-06-25 20:12:40 +00:00
<!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_151) on Tue Oct 31 17:36:52 EDT 2017 -->
<title>StockQuotesRMIForwarding (Oracle - Berkeley DB Java Edition Examples)</title>
<meta name="date" content="2017-10-31">
<link rel="stylesheet" type="text/css" href="../../../style.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="StockQuotesRMIForwarding (Oracle - Berkeley DB Java Edition Examples)";
}
}
catch(err) {
}
//-->
var methods = {"i0":9,"i1":10};
var tabs = {65535:["t0","All Methods"],1:["t1","Static 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="../../../je/rep/quote/package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</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"><b>Berkeley DB Java Edition Examples</b><br><font size=\"-1\"> version 7.5.11</font>
</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../je/rep/quote/StockQuotes.html" title="class in je.rep.quote"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../je/rep/quote/StockQuotesRMIForwarding.WriteServices.html" title="interface in je.rep.quote"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?je/rep/quote/StockQuotesRMIForwarding.html" target="_top">Frames</a></li>
<li><a href="StockQuotesRMIForwarding.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><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&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><a href="#field.detail">Field</a>&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">je.rep.quote</div>
<h2 title="Class StockQuotesRMIForwarding" class="title">Class StockQuotesRMIForwarding</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../je/rep/quote/StockQuotes.html" title="class in je.rep.quote">je.rep.quote.StockQuotes</a></li>
<li>
<ul class="inheritance">
<li>je.rep.quote.StockQuotesRMIForwarding</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>public class <span class="typeNameLabel">StockQuotesRMIForwarding</span>
extends <a href="../../../je/rep/quote/StockQuotes.html" title="class in je.rep.quote">StockQuotes</a></pre>
<div class="block">This example is a small variation on the basic <a href="../../../je/rep/quote/StockQuotes.html" title="class in je.rep.quote"><code>StockQuotes</code></a> example.
Instead of rejecting update requests made at a Replica's console, it
illustrates how RMI could be used to forward write requests to a Master. The
example is otherwise identical to <code>StockQuotes</code> and you should
read the javadoc associated with it before proceeding with this example. The
discussion that follows thus focusses entirely on the RMI based
write-forwarding aspects of this example.
<p>
Each node in this example is an RMI server and hosts an RMI registry. The
registry contains exactly one binding associated with the name:
<a href="../../../je/rep/quote/StockQuotesRMIForwarding.html#RMI_NAME"><code>RMI_NAME</code></a>. The object associated
with the RMI binding (an instance of <a href="../../../je/rep/quote/StockQuotesRMIForwarding.WriteServicesImpl.html" title="class in je.rep.quote"><code>StockQuotesRMIForwarding.WriteServicesImpl</code></a>) makes
available all the high level database write operations that are part of the
application. When this node is the <code>Master</code>,
<code>Replicas</code> will use the remote methods to invoke write operations
on it. All nodes are RMI servers, but only the current <code>Master</code>
is actually used to serve write requests while it is in the
<code>Master</code> state. The Replicas play the role of RMI clients making
remote method calls to the Master to foward their write requests.
<p>
Please review the javadoc in <a href="../../../je/rep/quote/StockQuotes.html" title="class in je.rep.quote"><code>StockQuotes</code></a> for a detailed description
of the arguments that must be supplied at startup. The only difference is
that you must use the name of this class when invoking the Java VM.
<p>
For example, the first node can be started as follows:
<pre>
java je.rep.quote.StockQuotesWriteForwarding -env /tmp/stockQuotes1 \
-nodeName n1 \
-nodeHost node.acme.com:5001 \
-helperHost node.acme.com:5001
</pre>
<p>
This instance of the application will therefore use port 5001 for HA, and,
by convention, port 5101 (5001 + <code>RMI_PORT_DISPLACEMENT</code>) for
the RMI registry. If you are running on multiple machines you may (depending
upon your DNS setup) need to specify the
<code>java.rmi.server.hostname</code> property to ensure that RMI does not
associate loopback addresses with entries in its registry.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ======== NESTED CLASS SUMMARY ======== -->
<ul class="blockList">
<li class="blockList"><a name="nested.class.summary">
<!-- -->
</a>
<h3>Nested Class Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Nested Class Summary table, listing nested classes, and an explanation">
<caption><span>Nested Classes</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Class and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static interface&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../je/rep/quote/StockQuotesRMIForwarding.WriteServices.html" title="interface in je.rep.quote">StockQuotesRMIForwarding.WriteServices</a></span></code>&nbsp;</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../je/rep/quote/StockQuotesRMIForwarding.WriteServicesImpl.html" title="class in je.rep.quote">StockQuotesRMIForwarding.WriteServicesImpl</a></span></code>
<div class="block">The class supplies the RMI implementation of the write methods.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- =========== FIELD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.summary">
<!-- -->
</a>
<h3>Field Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation">
<caption><span>Fields</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Field and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>static java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../je/rep/quote/StockQuotesRMIForwarding.html#RMI_NAME">RMI_NAME</a></span></code>&nbsp;</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="t1" class="tableTab"><span><a href="javascript:show(1);">Static Methods</a></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>static void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../je/rep/quote/StockQuotesRMIForwarding.html#main-java.lang.String:A-">main</a></span>(java.lang.String[]&nbsp;argv)</code>&nbsp;</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../je/rep/quote/StockQuotesRMIForwarding.html#quit-java.io.PrintStream-">quit</a></span>(java.io.PrintStream&nbsp;out)</code>
<div class="block">Performs the RMI associated cleanup so that the RMI serve can be
shutdown cleanly.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.java.lang.Object">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;java.lang.Object</h3>
<code>equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</code></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ FIELD DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="field.detail">
<!-- -->
</a>
<h3>Field Detail</h3>
<a name="RMI_NAME">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>RMI_NAME</h4>
<pre>public static final&nbsp;java.lang.String RMI_NAME</pre>
<dl>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../constant-values.html#je.rep.quote.StockQuotesRMIForwarding.RMI_NAME">Constant Field Values</a></dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method.detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="quit-java.io.PrintStream-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>quit</h4>
<pre>public&nbsp;void&nbsp;quit(java.io.PrintStream&nbsp;out)</pre>
<div class="block">Performs the RMI associated cleanup so that the RMI serve can be
shutdown cleanly.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../je/rep/quote/StockQuotes.html#quit-java.io.PrintStream-">quit</a></code>&nbsp;in class&nbsp;<code><a href="../../../je/rep/quote/StockQuotes.html" title="class in je.rep.quote">StockQuotes</a></code></dd>
</dl>
</li>
</ul>
<a name="main-java.lang.String:A-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>main</h4>
<pre>public static&nbsp;void&nbsp;main(java.lang.String[]&nbsp;argv)
throws java.lang.Exception</pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.Exception</code></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="../../../je/rep/quote/package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</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"><b>Berkeley DB Java Edition Examples</b><br><font size=\"-1\"> version 7.5.11</font>
</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../je/rep/quote/StockQuotes.html" title="class in je.rep.quote"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../je/rep/quote/StockQuotesRMIForwarding.WriteServices.html" title="interface in je.rep.quote"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?je/rep/quote/StockQuotesRMIForwarding.html" target="_top">Frames</a></li>
<li><a href="StockQuotesRMIForwarding.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><a href="#nested.class.summary">Nested</a>&nbsp;|&nbsp;</li>
<li><a href="#field.summary">Field</a>&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><a href="#field.detail">Field</a>&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><font size=1>Copyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved.</font> </small></p>
</body>
</html>