1<?xml version="1.0" encoding="UTF-8" standalone="no"?> 2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3<html xmlns="http://www.w3.org/1999/xhtml"> 4 <head> 5 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 6 <title>Managing Heartbeats</title> 7 <link rel="stylesheet" href="gettingStarted.css" type="text/css" /> 8 <meta name="generator" content="DocBook XSL Stylesheets V1.62.4" /> 9 <link rel="home" href="index.html" title="Getting Started with Replicated Berkeley DB Applications" /> 10 <link rel="up" href="repapp.html" title="Chapter��3.��The DB Replication Framework" /> 11 <link rel="previous" href="fmwrkconnectretry.html" title="Managing Connection Retries" /> 12 <link rel="next" href="fwrkmasterreplica.html" title="Chapter��4.��Replica versus Master Processes" /> 13 </head> 14 <body> 15 <div class="navheader"> 16 <table width="100%" summary="Navigation header"> 17 <tr> 18 <th colspan="3" align="center">Managing Heartbeats</th> 19 </tr> 20 <tr> 21 <td width="20%" align="left"><a accesskey="p" href="fmwrkconnectretry.html">Prev</a>��</td> 22 <th width="60%" align="center">Chapter��3.��The DB Replication Framework</th> 23 <td width="20%" align="right">��<a accesskey="n" href="fwrkmasterreplica.html">Next</a></td> 24 </tr> 25 </table> 26 <hr /> 27 </div> 28 <div class="sect1" lang="en" xml:lang="en"> 29 <div class="titlepage"> 30 <div> 31 <div> 32 <h2 class="title" style="clear: both"><a id="heartbeats"></a>Managing Heartbeats</h2> 33 </div> 34 </div> 35 <div></div> 36 </div> 37 <p> 38 If your replicated application experiences few updates, 39 it is possible for the replication group to lose a 40 master without noticing it. This is because normally a 41 replicated application only knows that a master has 42 gone missing when update activity causes messages to be 43 passed between the master and clients. 44 </p> 45 <p> 46 To guard against this, you can configure a heartbeat. 47 The heartbeat must be configured for both the master 48 and each of the clients. 49 </p> 50 <p> 51 On the master, you configure the application to send a 52 heartbeat on a defined interval when it is otherwise 53 idle. Do this by using the 54 55 <span> 56 <tt class="methodname">Environment.setReplicationTimeout()</tt>. 57 method. 58 You pass this method the 59 <tt class="methodname">ReplicationTimeoutType.HEARTBEAT_SEND</tt> 60 constant. 61 </span> 62 You must also provide the method a value representing the frequency of 63 the heartbeat. Note that the heartbeat is sent only if the 64 system is idle. 65 </p> 66 <p> 67 On the client, you configure the application to listen 68 for a heartbeat. The time that you configure here is 69 the amount of time the client will wait for some 70 message from the master (either the heartbeat or some 71 other message) before concluding that the connection is 72 lost. You do this using the 73 74 <span> 75 <tt class="methodname">Environment.setReplicationTimeout()</tt>. 76 method. 77 You pass this method the 78 <tt class="methodname">ReplicationTimeoutType.HEARTBEAT_MONITOR</tt> 79 constant and a timeout value in microseconds. 80 </span> 81 </p> 82 </div> 83 <div class="navfooter"> 84 <hr /> 85 <table width="100%" summary="Navigation footer"> 86 <tr> 87 <td width="40%" align="left"><a accesskey="p" href="fmwrkconnectretry.html">Prev</a>��</td> 88 <td width="20%" align="center"> 89 <a accesskey="u" href="repapp.html">Up</a> 90 </td> 91 <td width="40%" align="right">��<a accesskey="n" href="fwrkmasterreplica.html">Next</a></td> 92 </tr> 93 <tr> 94 <td width="40%" align="left" valign="top">Managing Connection Retries��</td> 95 <td width="20%" align="center"> 96 <a accesskey="h" href="index.html">Home</a> 97 </td> 98 <td width="40%" align="right" valign="top">��Chapter��4.��Replica versus Master Processes</td> 99 </tr> 100 </table> 101 </div> 102 </body> 103</html> 104