1 /* 2 * Copyright (C) MX4J. 3 * All rights reserved. 4 * 5 * This software is distributed under the terms of the MX4J License version 1.0. 6 * See the terms of the MX4J License in the documentation provided with this software. 7 */ 8 9 package mx4j.remote; 10 11 import java.io.IOException; 12 13 /** 14 * A continuous pulse from client to server that gives the information that 15 * the connection is alive and the server is up. 16 * 17 * @author <a HREF="mailto:biorn_steedom@users.sourceforge.net">Simone Bordet</a> 18 * @version $Revision: 1.2 $ 19 */ 20 public interface HeartBeat 21 { 22 /** 23 * Starts the heart beat 24 * @throws IOException If there are problems contacting the server 25 * @see #stop 26 */ 27 public void start() throws IOException; 28 29 /** 30 * Stops the heart beat 31 * @throws IOException If there are problems contacting the server 32 * @see #start 33 */ 34 public void stop() throws IOException; 35 36 /** 37 * Returns the period of time in milliseconds between two heart beats 38 * @see MX4JRemoteConstants#CONNECTION_HEARTBEAT_PERIOD 39 * @see #getMaxRetries 40 */ 41 public long getPulsePeriod(); 42 43 /** 44 * Returns the maximum number of retries this heart beat attempts after 45 * a first connection failure before declaring the connection or the server 46 * as dead. 47 * @see MX4JRemoteConstants#CONNECTION_HEARTBEAT_RETRIES 48 * @see #getPulsePeriod 49 */ 50 public int getMaxRetries(); 51 } 52