stasis/je-7.5.11/docs/java/com/sleepycat/je/rep/ReplicatedEnvironment.html
2019-06-25 16:12:40 -04:00

1293 lines
79 KiB
HTML

<!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:46 EDT 2017 -->
<title>ReplicatedEnvironment (Oracle - Berkeley DB Java Edition API)</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="ReplicatedEnvironment (Oracle - Berkeley DB Java Edition API)";
}
}
catch(err) {
}
//-->
var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10,"i8":10,"i9":10,"i10":10,"i11":10,"i12":10,"i13":10,"i14":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/ReplicatedEnvironment.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"><b>Berkeley DB Java Edition</b><br><font size=\"-1\"> version 7.5.11</font>
</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/sleepycat/je/rep/ReplicaStateException.html" title="class in com.sleepycat.je.rep"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.State.html" title="enum in com.sleepycat.je.rep"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/sleepycat/je/rep/ReplicatedEnvironment.html" target="_top">Frames</a></li>
<li><a href="ReplicatedEnvironment.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>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">com.sleepycat.je.rep</div>
<h2 title="Class ReplicatedEnvironment" class="title">Class ReplicatedEnvironment</h2>
</div>
<div class="contentContainer">
<ul class="inheritance">
<li>java.lang.Object</li>
<li>
<ul class="inheritance">
<li><a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je">com.sleepycat.je.Environment</a></li>
<li>
<ul class="inheritance">
<li>com.sleepycat.je.rep.ReplicatedEnvironment</li>
</ul>
</li>
</ul>
</li>
</ul>
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Implemented Interfaces:</dt>
<dd>java.io.Closeable, java.lang.AutoCloseable</dd>
</dl>
<hr>
<br>
<pre>public class <span class="typeNameLabel">ReplicatedEnvironment</span>
extends <a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je">Environment</a></pre>
<div class="block">A replicated database environment that is a node in a replication
group. Please read the <a
href="../../../../../ReplicationGuide/introduction.html">Berkeley DB JE High
Availability Overview</a> for an introduction to basic concepts and key
terminology.
<p>
Berkeley DB JE High Availability (JE HA) is a replicated, embedded database
management system which provides fast, reliable, and scalable data
management. JE HA enables replication of an environment across a Replication
Group. A ReplicatedEnvironment is a single node in the replication group.
<p>
ReplicatedEnvironment extends <a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je"><code>Environment</code></a>. All database operations
are executed in the same fashion in both replicated and non replicated
applications, using <a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je"><code>Environment</code></a> methods. A ReplicatedEnvironment
must be transactional. All replicated databases created in the replicated
environment must be transactional as well. However, <a
href="#nonRepDbs">non-replicated databases</a> may be used as well.
<p>
ReplicatedEnvironment handles are analogous to <a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je"><code>Environment</code></a>
handles. A replicated environment handle is a ReplicatedEnvironment
instance; multiple ReplicatedEnvironment instances may be created for the
same physical directory. In other words, more than one ReplicatedEnvironment
handle may be open at a time for a given environment.
</p>
<p>
A ReplicatedEnvironment joins its replication group when it is instantiated.
When the constructor returns, the node will have established contact with
the other members of the group and will be ready to service operations. The
<a href="../../../../../ReplicationGuide/lifecycle.html">life
cycle</a> overview is useful for understanding replication group creation.
<p>
The membership of a replication group is dynamically defined. The group
comes into being when ReplicatedEnvironments that are configured as members
of a group are created and discover each other. ReplicatedEnvironments are
identified by a group name, a node name, and a hostname:port
value. Membership information for electable and monitor nodes is stored in
an internal, replicated database available to electable and secondary nodes.
<p>
To start a node and join a group, instantiate a ReplicatedEnvironment. The
very first instantiation of a node differs slightly from all future
instantiations. A brand new, empty node does not yet have access to the
membership database, so it must discover the group with the aid of a
helper node, which is a fellow member. If this is the very first node of the
entire group, there is no available helper. Instead, the helper host address
to use is the node's own address. The example below takes the simple
approach of creating a replication group by starting up a node that will act
as the first master, though it is not necessary to follow this order.
<a
href="../../../../../ReplicationGuide/progoverview.html#configrepenv">
Configuring Replicated Environments</a> describes group startup in greater
detail.
<p>
To create the <b>master node in a brand new group</b>, instantiate a
ReplicatedEnvironment this way:
<pre class="code">
EnvironmentConfig envConfig = new EnvironmentConfig();
envConfig.setAllowCreate(true);
envConfig.setTransactional(true);
// Identify the node
ReplicationConfig repConfig = new ReplicationConfig();
repConfig.setGroupName("PlanetaryRepGroup");
repConfig.setNodeName("Mercury");
repConfig.setNodeHostPort("mercury.acme.com:5001");
// This is the first node, so its helper is itself
repConfig.setHelperHosts("mercury.acme.com:5001");
ReplicatedEnvironment repEnv =
new ReplicatedEnvironment(envHome, repConfig, envConfig);
</pre>
<p>
To create a new node when there are <b>other existing group members</b>,
set a helper address which points to an existing node in the group. A simple
way to bring up a new group is to "chain" the new nodes by having the
helpers reference a previously created node.
<pre class="code">
EnvironmentConfig envConfig = new EnvironmentConfig();
envConfig.setAllowCreate(true);
envConfig.setTransactional(true);
// Identify the node
ReplicationConfig repConfig =
new ReplicationConfig("PlanetaryRepGroup",
"Jupiter",
"jupiter.acme.com:5002");
// Use the node at mercury.acme.com:5001 as a helper to find the rest
// of the group.
repConfig.setHelperHosts("mercury.acme.com:5001");
ReplicatedEnvironment repEnv =
new ReplicatedEnvironment(envHome, repConfig, envConfig);
</pre>
<p>
In these examples, node Mercury was configured as its own helper, and
becomes the first master. The next nodes were configured to use Mercury as
their helper, and became replicas. It is also possible to start these in
reverse order, bringing mercury up last. In that case, the earlier nodes
will block until a helper is awake and can service their requests for group
metadata.
<p>
Creating a ReplicatedEnvironment for an <b>existing environment</b> requires
less configuration. The call
to <code>EnvironmentConfig.setAllowCreate()</code> is eliminated to guard
against the unintentional creation of a new environment. Also, there is no
need to set a helper host address, because the environment exists and has
access to the shared, persistent membership information.
<pre class="code">
EnvironmentConfig envConfig = new EnvironmentConfig();
envConfig.setTransactional(true);
ReplicationConfig repConfig =
new ReplicationConfig("PlanetaryRepGroup",
"Mercury",
"mercury.acme.com:5001");
ReplicatedEnvironment repEnv =
new ReplicatedEnvironment(envHome, repConfig, envConfig);
</pre>
</p>
See <a href="../../../../com/sleepycat/je/rep/util/ReplicationGroupAdmin.html" title="class in com.sleepycat.je.rep.util"><code>ReplicationGroupAdmin</code></a> for information on how to remove nodes from the
replication group.
<p>
ReplicatedEnvironment properties can be set via the the &lt;environmentHome&gt;/je.properties file, just like <a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je"><code>Environment</code></a>
properties. They follow the same property value precedence rules.
<p>
A replicated environment directory can only be accessed by a read write
ReplicatedEnvironment handle or a read only <a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je"><code>Environment</code></a> handle. In
the current release, there is an additional restriction that a read only
<a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je"><code>Environment</code></a> is only permitted when the directory is not also
accessed from a different process by a read/write ReplicatedEnvironment. If
a read/write ReplicatedEnvironment and a read only <a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je"><code>Environment</code></a> from
two different processes concurrently access an environment directory, there
is the small possibility that the read only <a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je"><code>Environment</code></a> may see
see exceptions thrown about an inconsistent log if the ReplicatedEnvironment
executes certain kinds of failover. There is no problem if the <a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je"><code>Environment</code></a> and ReplicatedEnvironment are in the same process, or are not
concurrent.
<p>
JE HA prohibits opening a replicated environment directory with a read/write
<a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je"><code>Environment</code></a> handle, because from the group's perspective,
unreplicated updates to a single node would cause data inconsistency. To
use an existing, non-replicated environment to bootstrap a replication
group, use <a href="../../../../com/sleepycat/je/rep/util/DbEnableReplication.html" title="class in com.sleepycat.je.rep.util"><code>DbEnableReplication</code></a> to do a one
time conversion of the directory.
<p>
All other database objects, such as <a href="../../../../com/sleepycat/je/Database.html" title="class in com.sleepycat.je"><code>Database</code></a> or
<a href="../../../../com/sleepycat/je/Cursor.html" title="class in com.sleepycat.je"><code>Cursor</code></a> (when using the Base API) or <a href="../../../../com/sleepycat/persist/EntityStore.html" title="class in com.sleepycat.persist"><code>EntityStore</code></a> or <a href="../../../../com/sleepycat/persist/PrimaryIndex.html" title="class in com.sleepycat.persist"><code>PrimaryIndex</code></a> (when using the Direct Persistence
Layer) should be created, used and closed before calling <a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#close--"><code>close()</code></a>.
<p>Replicated environments can be created with node type <a href="../../../../com/sleepycat/je/rep/NodeType.html#ELECTABLE"><code>NodeType.ELECTABLE</code></a> or <a href="../../../../com/sleepycat/je/rep/NodeType.html#SECONDARY"><code>NodeType.SECONDARY</code></a>. ELECTABLE nodes can be
masters or replicas, and participate in both master elections and commit
durability decisions.
<p>SECONDARY nodes can only be replicas, not masters, and do not participate
in either elections or durability decisions. SECONDARY nodes can be used to
increase the available number of read replicas without changing the election
or durability quorum of the group, and without requiring communication with
the secondaries during master elections or transaction commits. As a result,
SECONDARY nodes are a good choice for nodes that are connected to the other
nodes in the group by high latency network connections, for example over
long distance networks. SECONDARY nodes maintain replication streams with
the replication group master to update the data contents of their
environment.
<p>You can use SECONDARY nodes to:
<ul>
<li>Provide a copy of the data available at a distant location
<li>Maintain an extra copy of the data to increase redundancy
<li>Change the number of replicas to adjust to dynamically changing read
loads
</ul>
<p>Membership information for SECONDARY nodes is not stored persistently, so
their membership is only known to the master, and only while the nodes
remain connected to the master. Because a SECONDARY node cannot become a
master, it will not act as master even if it is the first node created for
the group.
<h3><a name="nonRepDbs">Non-replicated Databases in a Replicated
Environment</a></h3>
A database or entity store in a replicated environment is replicated by
default, but may be explicitly configured as non-replicated using
<a href="../../../../com/sleepycat/je/DatabaseConfig.html#setReplicated-boolean-"><code>DatabaseConfig.setReplicated(boolean)</code></a> or
<a href="../../../../com/sleepycat/persist/StoreConfig.html#setReplicated-boolean-"><code>StoreConfig.setReplicated(boolean)</code></a>. Such
non-replicated databases may be transactional or non-transactional
(including deferred-write and temporary). The special considerations for
using non-replicated databases in a replicated environment are described
below.
<p>
The data in a non-replicated database is not guaranteed to be persistent,
for two reasons.
<ul>
<li>
When a hard recovery occurs as part of an election, some data at the end of
the transaction log may be lost. For a replicated database this data is
automatically recovered from other members of the group, but for a
non-replicated database it is not.
</li>
<li>
When a node's contents are replaced via network restore or by otherwise
copying the transaction log from another node, all previously existing
non-replicated databases on that node are destroyed, and the non-replicated
databases from the source node are copied along with the replicated
data. The non-replicated databases copied from the source node will be in
whatever state they were in at the time of the copy.
</li>
</ul>
<p>
Therefore, non-replicated databases are intended to be used primarily for
persistent caching and other non-critical local storage. The application
is responsible for maintaining the state of the database and handling data
loss after one the events described above.
<p>
To perform write operations on a non-replicated database, special
considerations are necessary for user-supplied transactions. Namely, the
transaction must be configured for
<a href="../../../../com/sleepycat/je/TransactionConfig.html#setLocalWrite-boolean-"><code>local-write</code></a>. A given transaction may be used to write to either replicated
databases or non-replicated databases, but not both.
<p>
For auto-commit transactions (when the Transaction parameter is null), the
local-write setting is automatically set to correspond to whether the
database is replicated. With auto-commit, local-write is always true for a
non-replicated database, and always false for a replicated database.
<p>
A local-write transaction automatically uses
<a href="../../../../com/sleepycat/je/Durability.ReplicaAckPolicy.html#NONE"><code>Durability.ReplicaAckPolicy.NONE</code></a>.
A local-write transaction on a Master will thus not be held up, or
throw <a href="../../../../com/sleepycat/je/rep/InsufficientReplicasException.html" title="class in com.sleepycat.je.rep"><code>InsufficientReplicasException</code></a>, if the
Master is not in contact with a sufficient number of Replicas at the
time the transaction is initiated.
<p>
For read operations, a single transaction may be used to read any
combination of replicated and non-replicated databases. If only read
operations are performed, it is normally desirable to configure a user
supplied transaction as
<a href="../../../../com/sleepycat/je/TransactionConfig.html#setReadOnly-boolean-"><code>read-only</code></a>.
Like a local-write transaction, a read-only transaction automatically uses
<a href="../../../../com/sleepycat/je/Durability.ReplicaAckPolicy.html#NONE"><code>Durability.ReplicaAckPolicy.NONE</code></a>.
<p>
For user-supplied transactions, note that even when accessing only
non-replicated databases, group consistency checks <em>are</em> performed by
default. In this case it is normally desirable to disable consistency
checks by calling
<a href="../../../../com/sleepycat/je/TransactionConfig.html#setConsistencyPolicy-com.sleepycat.je.ReplicaConsistencyPolicy-"><code>TransactionConfig.setConsistencyPolicy(com.sleepycat.je.ReplicaConsistencyPolicy)</code></a> with
<a href="../../../../com/sleepycat/je/rep/NoConsistencyRequiredPolicy.html#NO_CONSISTENCY"><code>NoConsistencyRequiredPolicy.NO_CONSISTENCY</code></a>. This allows the
non-replicated databases to be accessed regardless of the state of the other
members of the group and the network connections to them. When auto-commit
is used (when the Transaction parameter is null) with a non-replicated
database, consistency checks are automatically disabled.</div>
<dl>
<dt><span class="simpleTagLabel">Since:</span></dt>
<dd>4.0</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je"><code>Environment</code></a>,
<a href="../../../../../ReplicationGuide/progoverview.html"
target="_top">Replication First Steps</a></dd>
</dl>
</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 class&nbsp;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.State.html" title="enum in com.sleepycat.je.rep">ReplicatedEnvironment.State</a></span></code>
<div class="block">The replication node state determines the operations that the
application can perform against its replicated environment.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- ======== 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="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#ReplicatedEnvironment-java.io.File-com.sleepycat.je.rep.ReplicationConfig-com.sleepycat.je.EnvironmentConfig-">ReplicatedEnvironment</a></span>(java.io.File&nbsp;envHome,
<a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html" title="class in com.sleepycat.je.rep">ReplicationConfig</a>&nbsp;repConfig,
<a href="../../../../com/sleepycat/je/EnvironmentConfig.html" title="class in com.sleepycat.je">EnvironmentConfig</a>&nbsp;envConfig)</code>
<div class="block">A convenience constructor that defaults the replica consistency policy
and the initial election policy to be used.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colOne"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#ReplicatedEnvironment-java.io.File-com.sleepycat.je.rep.ReplicationConfig-com.sleepycat.je.EnvironmentConfig-com.sleepycat.je.ReplicaConsistencyPolicy-com.sleepycat.je.rep.QuorumPolicy-">ReplicatedEnvironment</a></span>(java.io.File&nbsp;envHome,
<a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html" title="class in com.sleepycat.je.rep">ReplicationConfig</a>&nbsp;repConfig,
<a href="../../../../com/sleepycat/je/EnvironmentConfig.html" title="class in com.sleepycat.je">EnvironmentConfig</a>&nbsp;envConfig,
<a href="../../../../com/sleepycat/je/ReplicaConsistencyPolicy.html" title="interface in com.sleepycat.je">ReplicaConsistencyPolicy</a>&nbsp;consistencyPolicy,
<a href="../../../../com/sleepycat/je/rep/QuorumPolicy.html" title="enum in com.sleepycat.je.rep">QuorumPolicy</a>&nbsp;initialElectionPolicy)</code>
<div class="block">Creates a replicated environment handle and starts participating in the
replication group as either a Master or a Replica.</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="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#close--">close</a></span>()</code>
<div class="block">Close this ReplicatedEnvironment and release any resources used by the
handle.</div>
</td>
</tr>
<tr id="i1" class="rowColor">
<td class="colFirst"><code><a href="../../../../com/sleepycat/je/rep/ReplicationGroup.html" title="class in com.sleepycat.je.rep">ReplicationGroup</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#getGroup--">getGroup</a></span>()</code>
<div class="block">Returns a description of the replication group as known by this node.</div>
</td>
</tr>
<tr id="i2" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#getNodeName--">getNodeName</a></span>()</code>
<div class="block">Returns the unique name used to identify this replicated environment.</div>
</td>
</tr>
<tr id="i3" class="rowColor">
<td class="colFirst"><code><a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html" title="class in com.sleepycat.je.rep">ReplicationConfig</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#getRepConfig--">getRepConfig</a></span>()</code>
<div class="block">Return the replication configuration that has been used to create this
handle.</div>
</td>
</tr>
<tr id="i4" class="altColor">
<td class="colFirst"><code><a href="../../../../com/sleepycat/je/rep/ReplicationMutableConfig.html" title="class in com.sleepycat.je.rep">ReplicationMutableConfig</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#getRepMutableConfig--">getRepMutableConfig</a></span>()</code>&nbsp;</td>
</tr>
<tr id="i5" class="rowColor">
<td class="colFirst"><code><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironmentStats.html" title="class in com.sleepycat.je.rep">ReplicatedEnvironmentStats</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#getRepStats-com.sleepycat.je.StatsConfig-">getRepStats</a></span>(<a href="../../../../com/sleepycat/je/StatsConfig.html" title="class in com.sleepycat.je">StatsConfig</a>&nbsp;config)</code>
<div class="block">Returns statistics associated with this environment.</div>
</td>
</tr>
<tr id="i6" class="altColor">
<td class="colFirst"><code><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.State.html" title="enum in com.sleepycat.je.rep">ReplicatedEnvironment.State</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#getState--">getState</a></span>()</code>
<div class="block">Returns the current state of the node associated with this replication
environment.</div>
</td>
</tr>
<tr id="i7" class="rowColor">
<td class="colFirst"><code><a href="../../../../com/sleepycat/je/rep/StateChangeListener.html" title="interface in com.sleepycat.je.rep">StateChangeListener</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#getStateChangeListener--">getStateChangeListener</a></span>()</code>
<div class="block">Returns the listener used to receive asynchronous replication node state
change events.</div>
</td>
</tr>
<tr id="i8" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#printStartupInfo-java.io.PrintStream-">printStartupInfo</a></span>(java.io.PrintStream&nbsp;out)</code>
<div class="block">Print a detailed report about the costs of different phases of
environment startup.</div>
</td>
</tr>
<tr id="i9" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#registerAppStateMonitor-com.sleepycat.je.rep.AppStateMonitor-">registerAppStateMonitor</a></span>(<a href="../../../../com/sleepycat/je/rep/AppStateMonitor.html" title="interface in com.sleepycat.je.rep">AppStateMonitor</a>&nbsp;appStateMonitor)</code>
<div class="block">Registers an <a href="../../../../com/sleepycat/je/rep/AppStateMonitor.html" title="interface in com.sleepycat.je.rep"><code>AppStateMonitor</code></a> to receive the application state
which this <a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html" title="class in com.sleepycat.je.rep"><code>ReplicatedEnvironment</code></a> is running in.</div>
</td>
</tr>
<tr id="i10" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#setRepMutableConfig-com.sleepycat.je.rep.ReplicationMutableConfig-">setRepMutableConfig</a></span>(<a href="../../../../com/sleepycat/je/rep/ReplicationMutableConfig.html" title="class in com.sleepycat.je.rep">ReplicationMutableConfig</a>&nbsp;mutableConfig)</code>&nbsp;</td>
</tr>
<tr id="i11" class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#setStateChangeListener-com.sleepycat.je.rep.StateChangeListener-">setStateChangeListener</a></span>(<a href="../../../../com/sleepycat/je/rep/StateChangeListener.html" title="interface in com.sleepycat.je.rep">StateChangeListener</a>&nbsp;listener)</code>
<div class="block">Sets the listener used to receive asynchronous replication node state
change events.</div>
</td>
</tr>
<tr id="i12" class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#shutdownGroup-long-java.util.concurrent.TimeUnit-">shutdownGroup</a></span>(long&nbsp;replicaShutdownTimeout,
java.util.concurrent.TimeUnit&nbsp;unit)</code>
<div class="block">Closes this handle and shuts down the Replication Group by forcing all
active Replicas to exit.</div>
</td>
</tr>
<tr id="i13" class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#transferMaster-java.util.Set-int-java.util.concurrent.TimeUnit-">transferMaster</a></span>(java.util.Set&lt;java.lang.String&gt;&nbsp;replicas,
int&nbsp;timeout,
java.util.concurrent.TimeUnit&nbsp;timeUnit)</code>
<div class="block">Transfers the current master state from this node to one of the
electable replicas supplied in the argument list.</div>
</td>
</tr>
<tr id="i14" class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#transferMaster-java.util.Set-int-java.util.concurrent.TimeUnit-boolean-">transferMaster</a></span>(java.util.Set&lt;java.lang.String&gt;&nbsp;replicas,
int&nbsp;timeout,
java.util.concurrent.TimeUnit&nbsp;timeUnit,
boolean&nbsp;force)</code>
<div class="block">Transfers the current master state from this node to one of the replicas
supplied in the argument list.</div>
</td>
</tr>
</table>
<ul class="blockList">
<li class="blockList"><a name="methods.inherited.from.class.com.sleepycat.je.Environment">
<!-- -->
</a>
<h3>Methods inherited from class&nbsp;com.sleepycat.je.<a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je">Environment</a></h3>
<code><a href="../../../../com/sleepycat/je/Environment.html#beginTransaction-com.sleepycat.je.Transaction-com.sleepycat.je.TransactionConfig-">beginTransaction</a>, <a href="../../../../com/sleepycat/je/Environment.html#checkpoint-com.sleepycat.je.CheckpointConfig-">checkpoint</a>, <a href="../../../../com/sleepycat/je/Environment.html#cleanLog--">cleanLog</a>, <a href="../../../../com/sleepycat/je/Environment.html#cleanLogFile--">cleanLogFile</a>, <a href="../../../../com/sleepycat/je/Environment.html#compress--">compress</a>, <a href="../../../../com/sleepycat/je/Environment.html#evictMemory--">evictMemory</a>, <a href="../../../../com/sleepycat/je/Environment.html#flushLog-boolean-">flushLog</a>, <a href="../../../../com/sleepycat/je/Environment.html#getConfig--">getConfig</a>, <a href="../../../../com/sleepycat/je/Environment.html#getDatabaseNames--">getDatabaseNames</a>, <a href="../../../../com/sleepycat/je/Environment.html#getHome--">getHome</a>, <a href="../../../../com/sleepycat/je/Environment.html#getInvalidatingException--">getInvalidatingException</a>, <a href="../../../../com/sleepycat/je/Environment.html#getLockStats-com.sleepycat.je.StatsConfig-">getLockStats</a>, <a href="../../../../com/sleepycat/je/Environment.html#getMutableConfig--">getMutableConfig</a>, <a href="../../../../com/sleepycat/je/Environment.html#getStats-com.sleepycat.je.StatsConfig-">getStats</a>, <a href="../../../../com/sleepycat/je/Environment.html#getThreadTransaction--">getThreadTransaction</a>, <a href="../../../../com/sleepycat/je/Environment.html#getTransactionStats-com.sleepycat.je.StatsConfig-">getTransactionStats</a>, <a href="../../../../com/sleepycat/je/Environment.html#isClosed--">isClosed</a>, <a href="../../../../com/sleepycat/je/Environment.html#isInternalHandle--">isInternalHandle</a>, <a href="../../../../com/sleepycat/je/Environment.html#isValid--">isValid</a>, <a href="../../../../com/sleepycat/je/Environment.html#openDatabase-com.sleepycat.je.Transaction-java.lang.String-com.sleepycat.je.DatabaseConfig-">openDatabase</a>, <a href="../../../../com/sleepycat/je/Environment.html#openDiskOrderedCursor-com.sleepycat.je.Database:A-com.sleepycat.je.DiskOrderedCursorConfig-">openDiskOrderedCursor</a>, <a href="../../../../com/sleepycat/je/Environment.html#openSecondaryDatabase-com.sleepycat.je.Transaction-java.lang.String-com.sleepycat.je.Database-com.sleepycat.je.SecondaryConfig-">openSecondaryDatabase</a>, <a href="../../../../com/sleepycat/je/Environment.html#preload-com.sleepycat.je.Database:A-com.sleepycat.je.PreloadConfig-">preload</a>, <a href="../../../../com/sleepycat/je/Environment.html#removeDatabase-com.sleepycat.je.Transaction-java.lang.String-">removeDatabase</a>, <a href="../../../../com/sleepycat/je/Environment.html#renameDatabase-com.sleepycat.je.Transaction-java.lang.String-java.lang.String-">renameDatabase</a>, <a href="../../../../com/sleepycat/je/Environment.html#setMutableConfig-com.sleepycat.je.EnvironmentMutableConfig-">setMutableConfig</a>, <a href="../../../../com/sleepycat/je/Environment.html#setThreadTransaction-com.sleepycat.je.Transaction-">setThreadTransaction</a>, <a href="../../../../com/sleepycat/je/Environment.html#sync--">sync</a>, <a href="../../../../com/sleepycat/je/Environment.html#truncateDatabase-com.sleepycat.je.Transaction-java.lang.String-boolean-">truncateDatabase</a>, <a href="../../../../com/sleepycat/je/Environment.html#verify-com.sleepycat.je.VerifyConfig-java.io.PrintStream-">verify</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.Object</h3>
<code>clone, equals, finalize, 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">
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<ul class="blockList">
<li class="blockList"><a name="constructor.detail">
<!-- -->
</a>
<h3>Constructor Detail</h3>
<a name="ReplicatedEnvironment-java.io.File-com.sleepycat.je.rep.ReplicationConfig-com.sleepycat.je.EnvironmentConfig-com.sleepycat.je.ReplicaConsistencyPolicy-com.sleepycat.je.rep.QuorumPolicy-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ReplicatedEnvironment</h4>
<pre>public&nbsp;ReplicatedEnvironment(java.io.File&nbsp;envHome,
<a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html" title="class in com.sleepycat.je.rep">ReplicationConfig</a>&nbsp;repConfig,
<a href="../../../../com/sleepycat/je/EnvironmentConfig.html" title="class in com.sleepycat.je">EnvironmentConfig</a>&nbsp;envConfig,
<a href="../../../../com/sleepycat/je/ReplicaConsistencyPolicy.html" title="interface in com.sleepycat.je">ReplicaConsistencyPolicy</a>&nbsp;consistencyPolicy,
<a href="../../../../com/sleepycat/je/rep/QuorumPolicy.html" title="enum in com.sleepycat.je.rep">QuorumPolicy</a>&nbsp;initialElectionPolicy)
throws <a href="../../../../com/sleepycat/je/EnvironmentNotFoundException.html" title="class in com.sleepycat.je">EnvironmentNotFoundException</a>,
<a href="../../../../com/sleepycat/je/EnvironmentLockedException.html" title="class in com.sleepycat.je">EnvironmentLockedException</a>,
<a href="../../../../com/sleepycat/je/rep/InsufficientLogException.html" title="class in com.sleepycat.je.rep">InsufficientLogException</a>,
<a href="../../../../com/sleepycat/je/rep/ReplicaConsistencyException.html" title="class in com.sleepycat.je.rep">ReplicaConsistencyException</a>,
java.lang.IllegalArgumentException</pre>
<div class="block">Creates a replicated environment handle and starts participating in the
replication group as either a Master or a Replica. The node's state is
determined when it joins the group, and mastership is not preconfigured.
If the group has no current master and the node has the default node
type of <a href="../../../../com/sleepycat/je/rep/NodeType.html#ELECTABLE"><code>NodeType.ELECTABLE</code></a>, then creation of a handle will
trigger an election to determine whether this node will participate as a
Master or a Replica.
<p>
If the node participates as a Master, the constructor will return after
a sufficient number of Replicas, in accordance with the
<code>initialElectionPolicy</code> argument, have established contact with
the Master.
<p>
If the node participates as a Replica, it will become consistent in
accordance with the <code>consistencyPolicy</code> argument before returning
from the constructor.
<p>
If an election cannot be concluded in the time period defined by <a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html#ENV_SETUP_TIMEOUT"><code>ReplicationConfig.ENV_SETUP_TIMEOUT</code></a>, by default it will throw an <code>UnknownMasterException</code>. This behavior can be overridden via the <a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html#ENV_UNKNOWN_STATE_TIMEOUT"><code>ReplicationConfig.ENV_UNKNOWN_STATE_TIMEOUT</code></a> to permit the creation of
the handle in the <a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.State.html#UNKNOWN"><code>ReplicatedEnvironment.State.UNKNOWN</code></a> state. A handle in UNKNOWN state
can be used to service read operations with an appropriately relaxed
consistency policy. Note that these timeouts do not apply when opening
an environment for the very first time. In the first time case, if the
node is not the only group member, or if it is a SECONDARY node, the
constructor will wait indefinitely until it can contact an existing
group member.
<p>
A brand new node will always join an existing group as a Replica, unless
it is the very first electable node that is creating the group. In that
case it joins as the Master of the newly formed singleton group. A brand
new node must always specify one or more active helper nodes via the
<a href="../../../../com/sleepycat/je/rep/ReplicationMutableConfig.html#setHelperHosts-java.lang.String-"><code>ReplicationMutableConfig.setHelperHosts(String)</code></a> method, or via the
<code>&lt;environment home&gt;/je.properties</code> file. If this is the
very first member of a nascent group, it must specify just itself as the
helper.
<p>
There are special considerations to keep in mind when a replication
group is started and elections are first held to determine a master. The
default <a href="../../../../com/sleepycat/je/rep/QuorumPolicy.html#SIMPLE_MAJORITY"><code>QuorumPolicy.SIMPLE_MAJORITY</code></a> calls
for a simple majority vote. If the group members were previously created
and populated, the default election policy may result in the election of
a master that may not have the most up to date copy of the environment.
This could happen if the best qualified node is slow to start up; it's
possible that by the time it's ready to participate in an election, the
election has already have completed with a simple majority.
<p>
To avoid this possibility, the method has a parameter
initialElectionPolicy, which can be used to specify
<a href="../../../../com/sleepycat/je/rep/QuorumPolicy.html#ALL"><code>QuorumPolicy.ALL</code></a>, which will cause the
elections to wait until all electable nodes can vote. By ensuring that
all the nodes can vote, the best possible node is chosen to be the
master at group startup.
<p>
Note that it is the application's responsibility to ensure that all
electable nodes coordinate their choice of initialElectionPolicy so that
the very first elections held when a group is brought up use the same
value for this parameter. This parameter is only used for the first
election. After the first election has been held and the group is
functioning, subsequent elections do not require participation of all
the nodes. A simple majority is sufficient to elect the node with the
most up to date environment as the master.
<p></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>envHome</code> - The environment's home directory.</dd>
<dd><code>repConfig</code> - replication configurations. If null, the default
replication configurations are used.</dd>
<dd><code>envConfig</code> - environment configurations for this node. If null, the
default environment configurations are used.</dd>
<dd><code>consistencyPolicy</code> - the consistencyPolicy used by the Replica at
startup to make its environment current with respect to the master. This
differs from the consistency policy specified
<a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html#setConsistencyPolicy-com.sleepycat.je.ReplicaConsistencyPolicy-"><code>ReplicationConfig.setConsistencyPolicy(com.sleepycat.je.ReplicaConsistencyPolicy)</code></a> because it is used only
at construction, when the node joins the group for the first time. The
consistency policy set in <a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html" title="class in com.sleepycat.je.rep"><code>ReplicationConfig</code></a> is used any time a
policy is used after node startup, such as at transaction begins.</dd>
<dd><code>initialElectionPolicy</code> - the policy to use when holding the initial
election.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../com/sleepycat/je/rep/RestartRequiredException.html" title="class in com.sleepycat.je.rep">RestartRequiredException</a></code> - if some type of corrective action is
required. The subclasses of this exception provide further details.</dd>
<dd><code><a href="../../../../com/sleepycat/je/rep/ReplicaConsistencyException.html" title="class in com.sleepycat.je.rep">ReplicaConsistencyException</a></code> - if it is a Replica and cannot
satisfy the specified consistency policy within the consistency timeout
period</dd>
<dd><code><a href="../../../../com/sleepycat/je/rep/UnknownMasterException.html" title="class in com.sleepycat.je.rep">UnknownMasterException</a></code> - if the
<a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html#ENV_UNKNOWN_STATE_TIMEOUT"><code>ReplicationConfig.ENV_UNKNOWN_STATE_TIMEOUT</code></a> has a zero value and
the node cannot join the group in the time period specified by the
<a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html#ENV_SETUP_TIMEOUT"><code>ReplicationConfig.ENV_SETUP_TIMEOUT</code></a> property. The node may be
unable to join the group because the Master could not be determined due
to a lack of sufficient nodes as required by the election policy, or
because a master was present but lacked a
<a href="../../../../com/sleepycat/je/rep/QuorumPolicy.html#SIMPLE_MAJORITY"><code>QuorumPolicy.SIMPLE_MAJORITY</code></a> needed to update the environment
with information about this node, if it's a new node and is joining the
group for the first time.</dd>
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
environment-wide failure occurs.</dd>
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentLockedException.html" title="class in com.sleepycat.je">EnvironmentLockedException</a></code> - when an environment cannot be opened
for write access because another process has the same environment open
for write access. <strong>Warning:</strong> This exception should be
handled when an environment is opened by more than one process.</dd>
<dd><code><a href="../../../../com/sleepycat/je/VersionMismatchException.html" title="class in com.sleepycat.je">VersionMismatchException</a></code> - when the existing log is not compatible
with the version of JE that is running. This occurs when a later version
of JE was used to create the log. <strong>Warning:</strong> This
exception should be handled when more than one version of JE may be used
to access an environment.</dd>
<dd><code>java.lang.UnsupportedOperationException</code> - if the environment exists and has
not been enabled for replication.</dd>
<dd><code>java.lang.IllegalArgumentException</code> - if an invalid parameter is specified,
for example, an invalid <code>EnvironmentConfig</code> parameter.</dd>
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentNotFoundException.html" title="class in com.sleepycat.je">EnvironmentNotFoundException</a></code></dd>
<dd><code><a href="../../../../com/sleepycat/je/rep/InsufficientLogException.html" title="class in com.sleepycat.je.rep">InsufficientLogException</a></code></dd>
</dl>
</li>
</ul>
<a name="ReplicatedEnvironment-java.io.File-com.sleepycat.je.rep.ReplicationConfig-com.sleepycat.je.EnvironmentConfig-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>ReplicatedEnvironment</h4>
<pre>public&nbsp;ReplicatedEnvironment(java.io.File&nbsp;envHome,
<a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html" title="class in com.sleepycat.je.rep">ReplicationConfig</a>&nbsp;repConfig,
<a href="../../../../com/sleepycat/je/EnvironmentConfig.html" title="class in com.sleepycat.je">EnvironmentConfig</a>&nbsp;envConfig)
throws <a href="../../../../com/sleepycat/je/EnvironmentNotFoundException.html" title="class in com.sleepycat.je">EnvironmentNotFoundException</a>,
<a href="../../../../com/sleepycat/je/EnvironmentLockedException.html" title="class in com.sleepycat.je">EnvironmentLockedException</a>,
<a href="../../../../com/sleepycat/je/rep/ReplicaConsistencyException.html" title="class in com.sleepycat.je.rep">ReplicaConsistencyException</a>,
<a href="../../../../com/sleepycat/je/rep/InsufficientLogException.html" title="class in com.sleepycat.je.rep">InsufficientLogException</a>,
<a href="../../../../com/sleepycat/je/rep/RollbackException.html" title="class in com.sleepycat.je.rep">RollbackException</a>,
java.lang.IllegalArgumentException</pre>
<div class="block">A convenience constructor that defaults the replica consistency policy
and the initial election policy to be used.
<p>
The default replica consistency policy results in the replica being
consistent with the master as of the time the handle was created.
</p>
<p>
The default initial election policy is
<a href="../../../../com/sleepycat/je/rep/QuorumPolicy.html#SIMPLE_MAJORITY"><code>QuorumPolicy.SIMPLE_MAJORITY</code></a>
</p></div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../com/sleepycat/je/rep/RestartRequiredException.html" title="class in com.sleepycat.je.rep">RestartRequiredException</a></code> - if some type of corrective action is
required. The subclasses of this exception provide further details.</dd>
<dd><code><a href="../../../../com/sleepycat/je/rep/ReplicaConsistencyException.html" title="class in com.sleepycat.je.rep">ReplicaConsistencyException</a></code> - if it is a Replica and and cannot be
made consistent within the timeout specified by
<a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html#ENV_CONSISTENCY_TIMEOUT"><code>ReplicationConfig.ENV_CONSISTENCY_TIMEOUT</code></a></dd>
<dd><code><a href="../../../../com/sleepycat/je/rep/UnknownMasterException.html" title="class in com.sleepycat.je.rep">UnknownMasterException</a></code> - if the
<a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html#ENV_UNKNOWN_STATE_TIMEOUT"><code>ReplicationConfig.ENV_UNKNOWN_STATE_TIMEOUT</code></a> has a zero value and
the node cannot join the group in the time period specified by the
<a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html#ENV_SETUP_TIMEOUT"><code>ReplicationConfig.ENV_SETUP_TIMEOUT</code></a> property. The node may be
unable to join the group because the Master could not be determined due
to a lack of sufficient nodes as required by the election policy, or
because a master was present but lacked a
<a href="../../../../com/sleepycat/je/rep/QuorumPolicy.html#SIMPLE_MAJORITY"><code>QuorumPolicy.SIMPLE_MAJORITY</code></a> needed to update the environment
with information about this node, if it's a new node and is joining the
group for the first time.</dd>
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentLockedException.html" title="class in com.sleepycat.je">EnvironmentLockedException</a></code> - when an environment cannot be opened
for write access because another process has the same environment open
for write access. <strong>Warning:</strong> This exception should be
handled when an environment is opened by more than one process.</dd>
<dd><code><a href="../../../../com/sleepycat/je/VersionMismatchException.html" title="class in com.sleepycat.je">VersionMismatchException</a></code> - when the existing log is not compatible
with the version of JE that is running. This occurs when a later version
of JE was used to create the log. <strong>Warning:</strong> This
exception should be handled when more than one version of JE may be used
to access an environment.</dd>
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
environment-wide failure occurs.</dd>
<dd><code>java.lang.UnsupportedOperationException</code> - if the environment exists and has
not been enabled for replication.</dd>
<dd><code>java.lang.IllegalArgumentException</code> - if an invalid parameter is specified,
for example, an invalid <code>EnvironmentConfig</code> parameter.</dd>
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentNotFoundException.html" title="class in com.sleepycat.je">EnvironmentNotFoundException</a></code></dd>
<dd><code><a href="../../../../com/sleepycat/je/rep/InsufficientLogException.html" title="class in com.sleepycat.je.rep">InsufficientLogException</a></code></dd>
<dd><code><a href="../../../../com/sleepycat/je/rep/RollbackException.html" title="class in com.sleepycat.je.rep">RollbackException</a></code></dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#ReplicatedEnvironment-java.io.File-com.sleepycat.je.rep.ReplicationConfig-com.sleepycat.je.EnvironmentConfig-com.sleepycat.je.ReplicaConsistencyPolicy-com.sleepycat.je.rep.QuorumPolicy-"><code>ReplicatedEnvironment(File, ReplicationConfig, EnvironmentConfig,
ReplicaConsistencyPolicy, QuorumPolicy)</code></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="getNodeName--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getNodeName</h4>
<pre>public&nbsp;java.lang.String&nbsp;getNodeName()</pre>
<div class="block">Returns the unique name used to identify this replicated environment.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the node name</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html#setNodeName-java.lang.String-"><code>ReplicationConfig.setNodeName(java.lang.String)</code></a></dd>
</dl>
</li>
</ul>
<a name="getState--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getState</h4>
<pre>public&nbsp;<a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.State.html" title="enum in com.sleepycat.je.rep">ReplicatedEnvironment.State</a>&nbsp;getState()
throws <a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
<div class="block">Returns the current state of the node associated with this replication
environment. See <a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.State.html" title="enum in com.sleepycat.je.rep"><code>ReplicatedEnvironment.State</code></a> for a description of node states.
<p>
If the caller's intent is to track the state of the node,
<a href="../../../../com/sleepycat/je/rep/StateChangeListener.html" title="interface in com.sleepycat.je.rep"><code>StateChangeListener</code></a> may be a more convenient and efficient
approach, rather than using getState() directly.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the current replication state associated with this node</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
environment-wide failure occurs.</dd>
<dd><code>java.lang.IllegalStateException</code> - if this handle or the underlying
environment has already been closed.</dd>
<dd><code><a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code></dd>
</dl>
</li>
</ul>
<a name="getGroup--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getGroup</h4>
<pre>public&nbsp;<a href="../../../../com/sleepycat/je/rep/ReplicationGroup.html" title="class in com.sleepycat.je.rep">ReplicationGroup</a>&nbsp;getGroup()
throws <a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
<div class="block">Returns a description of the replication group as known by this node.
The replicated group metadata is stored in a replicated database and
updates are propagated by the current master node to all replicas. If
this node is not the master, it is possible for its description of the
group to be out of date, and it will not include information about
SECONDARY nodes.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the group description</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
environment-wide failure occurs.</dd>
<dd><code>java.lang.IllegalStateException</code> - if this handle or the underlying
environment has already been closed.</dd>
<dd><code><a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code></dd>
</dl>
</li>
</ul>
<a name="close--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>close</h4>
<pre>public&nbsp;void&nbsp;close()
throws <a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
<div class="block">Close this ReplicatedEnvironment and release any resources used by the
handle.
<p>
When the last handle is closed, allocated resources are freed, and
daemon threads are stopped, even if they are performing work. The node
ceases participation in the replication group. If the node was currently
the master, the rest of the group will hold an election. If a quorum of
nodes can participate in the election, a new master will be chosen.
<p>
The ReplicatedEnvironment should not be closed while any other type of
handle that refers to it is not yet closed. For example, the
ReplicatedEnvironment should not be closed while there are open Database
instances, or while transactions in the environment have not yet
committed or aborted. Specifically, this includes <a href="../../../../com/sleepycat/je/Database.html" title="class in com.sleepycat.je"><code>Database</code></a>, <a href="../../../../com/sleepycat/je/Cursor.html" title="class in com.sleepycat.je"><code>Cursor</code></a> and <a href="../../../../com/sleepycat/je/Transaction.html" title="class in com.sleepycat.je"><code>Transaction</code></a> handles.
</p>
<p>WARNING: To guard against memory leaks, the application should
discard all references to the closed handle. While BDB makes an effort
to discard references from closed objects to the allocated memory for an
environment, this behavior is not guaranteed. The safe course of action
for an application is to discard all references to closed BDB
objects.</p></div>
<dl>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>close</code>&nbsp;in interface&nbsp;<code>java.io.Closeable</code></dd>
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
<dd><code>close</code>&nbsp;in interface&nbsp;<code>java.lang.AutoCloseable</code></dd>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../com/sleepycat/je/Environment.html#close--">close</a></code>&nbsp;in class&nbsp;<code><a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je">Environment</a></code></dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code></dd>
</dl>
</li>
</ul>
<a name="setStateChangeListener-com.sleepycat.je.rep.StateChangeListener-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setStateChangeListener</h4>
<pre>public&nbsp;void&nbsp;setStateChangeListener(<a href="../../../../com/sleepycat/je/rep/StateChangeListener.html" title="interface in com.sleepycat.je.rep">StateChangeListener</a>&nbsp;listener)
throws <a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
<div class="block">Sets the listener used to receive asynchronous replication node state
change events. Note that there is one listener per replication node, not
one per handle. Invoking this method replaces the previous Listener.
Invoking this method typically results in an immediate callback to the
application via the <a href="../../../../com/sleepycat/je/rep/StateChangeListener.html#stateChange-com.sleepycat.je.rep.StateChangeEvent-"><code>StateChangeListener.stateChange(com.sleepycat.je.rep.StateChangeEvent)</code></a> method, so
that the application is made aware of the existing state of the
node at the time <code>StateChangeListener</code> is first established.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>listener</code> - the state change listener.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
environment-wide failure occurs.</dd>
<dd><code>java.lang.IllegalStateException</code> - if this handle or the underlying
environment has already been closed.</dd>
<dd><code><a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code></dd>
</dl>
</li>
</ul>
<a name="getStateChangeListener--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getStateChangeListener</h4>
<pre>public&nbsp;<a href="../../../../com/sleepycat/je/rep/StateChangeListener.html" title="interface in com.sleepycat.je.rep">StateChangeListener</a>&nbsp;getStateChangeListener()
throws <a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
<div class="block">Returns the listener used to receive asynchronous replication node state
change events. A StateChangeListener provides the replication
application with an asynchronous mechanism for tracking the <a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.State.html" title="enum in com.sleepycat.je.rep"><code>State</code></a> of the replicated environment.
<p>
Note that there is one listener per replication node, not one per
ReplicatedEnvironment handle.</div>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
environment-wide failure occurs.</dd>
<dd><code>java.lang.IllegalStateException</code> - if this handle or the underlying
environment has already been closed.</dd>
<dd><code><a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code></dd>
</dl>
</li>
</ul>
<a name="setRepMutableConfig-com.sleepycat.je.rep.ReplicationMutableConfig-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>setRepMutableConfig</h4>
<pre>public&nbsp;void&nbsp;setRepMutableConfig(<a href="../../../../com/sleepycat/je/rep/ReplicationMutableConfig.html" title="class in com.sleepycat.je.rep">ReplicationMutableConfig</a>&nbsp;mutableConfig)
throws <a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
environment-wide failure occurs.</dd>
<dd><code>java.lang.IllegalStateException</code> - if this handle or the underlying
environment has already been closed.</dd>
<dd><code><a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code></dd>
</dl>
</li>
</ul>
<a name="getRepMutableConfig--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRepMutableConfig</h4>
<pre>public&nbsp;<a href="../../../../com/sleepycat/je/rep/ReplicationMutableConfig.html" title="class in com.sleepycat.je.rep">ReplicationMutableConfig</a>&nbsp;getRepMutableConfig()
throws <a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
<dl>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
environment-wide failure occurs.</dd>
<dd><code>java.lang.IllegalStateException</code> - if this handle or the underlying
environment has already been closed.</dd>
<dd><code><a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code></dd>
</dl>
</li>
</ul>
<a name="getRepConfig--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRepConfig</h4>
<pre>public&nbsp;<a href="../../../../com/sleepycat/je/rep/ReplicationConfig.html" title="class in com.sleepycat.je.rep">ReplicationConfig</a>&nbsp;getRepConfig()
throws <a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
<div class="block">Return the replication configuration that has been used to create this
handle. This is derived from the original configuration argument, after
cloning a copy to keep it distinct from the user's instance, applying
je.properties settings, and validating against the underlying
node.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>this handle's configuration.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
environment-wide failure occurs.</dd>
<dd><code>java.lang.IllegalStateException</code> - if this handle or the underlying
environment has already been closed.</dd>
<dd><code><a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code></dd>
</dl>
</li>
</ul>
<a name="getRepStats-com.sleepycat.je.StatsConfig-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getRepStats</h4>
<pre>public&nbsp;<a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironmentStats.html" title="class in com.sleepycat.je.rep">ReplicatedEnvironmentStats</a>&nbsp;getRepStats(<a href="../../../../com/sleepycat/je/StatsConfig.html" title="class in com.sleepycat.je">StatsConfig</a>&nbsp;config)
throws <a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></pre>
<div class="block">Returns statistics associated with this environment. See <a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironmentStats.html" title="class in com.sleepycat.je.rep"><code>ReplicatedEnvironmentStats</code></a> for the kind of information available.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>config</code> - is used to specify attributes such as whether the stats
should be cleared, whether the complete set of stats should be obtained,
etc.</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../com/sleepycat/je/EnvironmentFailureException.html" title="class in com.sleepycat.je">EnvironmentFailureException</a></code> - if an unexpected, internal or
environment-wide failure occurs.</dd>
<dd><code>java.lang.IllegalStateException</code> - if this handle or the underlying
environment has already been closed.</dd>
<dd><code><a href="../../../../com/sleepycat/je/DatabaseException.html" title="class in com.sleepycat.je">DatabaseException</a></code></dd>
</dl>
</li>
</ul>
<a name="printStartupInfo-java.io.PrintStream-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>printStartupInfo</h4>
<pre>public&nbsp;void&nbsp;printStartupInfo(java.io.PrintStream&nbsp;out)</pre>
<div class="block">Print a detailed report about the costs of different phases of
environment startup. This report is by default logged to the je.info
file if startup takes longer than je.env.startupThreshold.</div>
<dl>
<dt><span class="overrideSpecifyLabel">Overrides:</span></dt>
<dd><code><a href="../../../../com/sleepycat/je/Environment.html#printStartupInfo-java.io.PrintStream-">printStartupInfo</a></code>&nbsp;in class&nbsp;<code><a href="../../../../com/sleepycat/je/Environment.html" title="class in com.sleepycat.je">Environment</a></code></dd>
</dl>
</li>
</ul>
<a name="shutdownGroup-long-java.util.concurrent.TimeUnit-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>shutdownGroup</h4>
<pre>public&nbsp;void&nbsp;shutdownGroup(long&nbsp;replicaShutdownTimeout,
java.util.concurrent.TimeUnit&nbsp;unit)
throws java.lang.IllegalStateException</pre>
<div class="block">Closes this handle and shuts down the Replication Group by forcing all
active Replicas to exit.
<p>
This method must be invoked on the node that's currently the Master
after all other outstanding handles have been closed.
<p>
The Master waits for all active Replicas to catch up so that they have a
current set of logs, and then shuts them down. The Master will wait for
a maximum of <code>replicaShutdownTimeout</code> for a Replica to catch
up. If the Replica has not caught up in this time period it will force
the Replica to shut down before it is completely caught up. A negative
or zero <code>replicaShutdownTimeout</code> value will result in an
immediate shutdown without waiting for lagging Replicas to catch up.
Nodes that are currently inactive cannot be contacted by the Master, as
a consequence, their state is not impacted by the shutdown.
<p>
The shutdown operation will close this handle on the Master node. The
environments on Replica nodes will be invalidated, and attempts to use
those handles will result in a <a href="../../../../com/sleepycat/je/rep/GroupShutdownException.html" title="class in com.sleepycat.je.rep"><code>GroupShutdownException</code></a> being
thrown. The application is responsible for closing the remaining handles
on the Replica.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>replicaShutdownTimeout</code> - the maximum amount of time the Master
waits for a Replica to shutdown.</dd>
<dd><code>unit</code> - the time unit associated with the
<code>replicaShutdownTimeout</code></dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if the method is invoked on a node that's
not currently the Master, or there are other open handles to this
Environment.</dd>
</dl>
</li>
</ul>
<a name="registerAppStateMonitor-com.sleepycat.je.rep.AppStateMonitor-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>registerAppStateMonitor</h4>
<pre>public&nbsp;void&nbsp;registerAppStateMonitor(<a href="../../../../com/sleepycat/je/rep/AppStateMonitor.html" title="interface in com.sleepycat.je.rep">AppStateMonitor</a>&nbsp;appStateMonitor)
throws java.lang.IllegalStateException</pre>
<div class="block">Registers an <a href="../../../../com/sleepycat/je/rep/AppStateMonitor.html" title="interface in com.sleepycat.je.rep"><code>AppStateMonitor</code></a> to receive the application state
which this <a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html" title="class in com.sleepycat.je.rep"><code>ReplicatedEnvironment</code></a> is running in. Note that there
is only one <code>AppStateMonitor</code> per replication node, not one
per handle. Invoking this method replaces the previous
<code>AppStateMonitor</code>.
<p>
After registration, the application state can be returned by invoking
<a href="../../../../com/sleepycat/je/rep/util/ReplicationGroupAdmin.html#getNodeState-com.sleepycat.je.rep.ReplicationNode-int-"><code>ReplicationGroupAdmin.getNodeState(com.sleepycat.je.rep.ReplicationNode, int)</code></a>.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>appStateMonitor</code> - the user implemented AppStateMonitor</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - if this handle or the underlying
environment has already been closed.</dd>
</dl>
</li>
</ul>
<a name="transferMaster-java.util.Set-int-java.util.concurrent.TimeUnit-">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>transferMaster</h4>
<pre>public&nbsp;java.lang.String&nbsp;transferMaster(java.util.Set&lt;java.lang.String&gt;&nbsp;replicas,
int&nbsp;timeout,
java.util.concurrent.TimeUnit&nbsp;timeUnit)</pre>
<div class="block">Transfers the current master state from this node to one of the
electable replicas supplied in the argument list. The replica that is
actually chosen to be the new master is the one with which the Master
Transfer can be completed most rapidly. The transfer operation ensures
that all changes at this node are available at the new master upon
conclusion of the operation.
<p>
The following sequence of steps is used to accomplish the transfer:
<ol>
<li>The master first waits for at least one replica, from
amongst the supplied <code>Set</code> of candidate replicas, to
become reasonably current. It may have to wait for at least
one of the replicas to establish a feeder, if none of them are
currently connected to the master. "Reasonably current" means
that the replica is close enough to the end of the transaction
stream that it has managed to acknowledge a transaction within
the time that the commit thread is still awaiting
acknowledgments. If the candidate replicas are working
through a long backlog after having been disconnected, this can
take some time, so the timeout value should be chosen to allow
for this possibility.
<li>The master blocks new transactions from being committed or
aborted.
<li>The master now waits for one of the candidate replicas to
become fully current (completely caught up with the end of the
log on the master). The first replica that becomes current is
the one that is chosen to become the new master. This second
wait period is expected to be brief, since it only has to wait
until transactions that were committed in the interval between
step 1) and step 2) have been acknowledged by a replica.
<li>The master sends messages to all other nodes announcing the chosen
replica as the new master. This node will eventually become a replica,
and any subsequent attempt commit or abort existing transactions, or to
do write operations will result in a <code>ReplicaWriteException</code>.
<li>The current master releases the transactions that were blocked in
step 2) allowing them to proceed. The released transactions will fail
with <code>ReplicaWriteException</code> since the environment has become a
replica.
</ol></div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>replicas</code> - the set of replicas to be considered when choosing the
new master. The method returns immediately if this node is a member of
the set.</dd>
<dd><code>timeout</code> - the amount of time to allow for the transfer to be
accomplished. A <code>MasterTransferFailureException</code> is thrown if the
transfer is not accomplished within this timeout period.</dd>
<dd><code>timeUnit</code> - the time unit associated with the timeout</dd>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the name of the replica that was chosen to be the new master
from amongst the set of supplied replicas</dd>
<dt><span class="throwsLabel">Throws:</span></dt>
<dd><code><a href="../../../../com/sleepycat/je/rep/MasterTransferFailureException.html" title="class in com.sleepycat.je.rep">MasterTransferFailureException</a></code> - if the master transfer operation
fails</dd>
<dd><code>java.lang.IllegalArgumentException</code> - if any of the named replicas is not a
member of the replication group or is not of type
<a href="../../../../com/sleepycat/je/rep/NodeType.html#ELECTABLE"><code>NodeType.ELECTABLE</code></a></dd>
<dd><code>java.lang.IllegalStateException</code> - if this node is not currently the master,
or this handle or the underlying environment has already been closed.</dd>
</dl>
</li>
</ul>
<a name="transferMaster-java.util.Set-int-java.util.concurrent.TimeUnit-boolean-">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>transferMaster</h4>
<pre>public&nbsp;java.lang.String&nbsp;transferMaster(java.util.Set&lt;java.lang.String&gt;&nbsp;replicas,
int&nbsp;timeout,
java.util.concurrent.TimeUnit&nbsp;timeUnit,
boolean&nbsp;force)</pre>
<div class="block">Transfers the current master state from this node to one of the replicas
supplied in the argument list.</div>
<dl>
<dt><span class="paramLabel">Parameters:</span></dt>
<dd><code>force</code> - true if this request should supersede and cancel any
currently pending Master Transfer operation</dd>
<dt><span class="seeLabel">See Also:</span></dt>
<dd><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.html#transferMaster-java.util.Set-int-java.util.concurrent.TimeUnit-"><code>transferMaster(Set, int, TimeUnit)</code></a></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/ReplicatedEnvironment.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"><b>Berkeley DB Java Edition</b><br><font size=\"-1\"> version 7.5.11</font>
</div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../com/sleepycat/je/rep/ReplicaStateException.html" title="class in com.sleepycat.je.rep"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../com/sleepycat/je/rep/ReplicatedEnvironment.State.html" title="enum in com.sleepycat.je.rep"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../index.html?com/sleepycat/je/rep/ReplicatedEnvironment.html" target="_top">Frames</a></li>
<li><a href="ReplicatedEnvironment.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>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><font size=1>Copyright (c) 2002, 2017 Oracle and/or its affiliates. All rights reserved.</font> </small></p>
</body>
</html>