org.jgroups.protocols

Class FD_SOCK

public class FD_SOCK extends Protocol implements Runnable

Failure detection protocol based on sockets. Failure detection is ring-based. Each member creates a server socket and announces its address together with the server socket's address in a multicast. A pinger thread will be started when the membership goes above 1 and will be stopped when it drops below 2. The pinger thread connects to its neighbor on the right and waits until the socket is closed. When the socket is closed by the monitored peer in an abnormal fashion (IOException), the neighbor will be suspected.

The main feature of this protocol is that no ping messages need to be exchanged between any 2 peers, and failure detection relies entirely on TCP sockets. The advantage is that no activity will take place between 2 peers as long as they are alive (i.e. have their server sockets open). The disadvantage is that hung servers or crashed routers will not cause sockets to be closed, therefore they won't be detected. The FD_SOCK protocol will work for groups where members are on different hosts

The costs involved are 2 additional threads: one that monitors the client side of the socket connection (to monitor a peer) and another one that manages the server socket. However, those threads will be idle as long as both peers are running.

Author: Bela Ban May 29 2001

Nested Class Summary
static classFD_SOCK.FdHeader
Method Summary
voiddown(Event evt)
StringgetLocalAddress()
StringgetMembers()
StringgetName()
intgetNumSuspectEventsGenerated()
StringgetPingableMembers()
StringgetPingDest()
voidinit()
StringprintSuspectHistory()
voidresetStats()
voidrun()
Runs as long as there are 2 members and more.
booleansetProperties(Properties props)
voidstop()
voidup(Event evt)

Method Detail

down

public void down(Event evt)

getLocalAddress

public String getLocalAddress()

getMembers

public String getMembers()

getName

public String getName()

getNumSuspectEventsGenerated

public int getNumSuspectEventsGenerated()

getPingableMembers

public String getPingableMembers()

getPingDest

public String getPingDest()

init

public void init()

printSuspectHistory

public String printSuspectHistory()

resetStats

public void resetStats()

run

public void run()
Runs as long as there are 2 members and more. Determines the member to be monitored and fetches its server socket address (if n/a, sends a message to obtain it). The creates a client socket and listens on it until the connection breaks. If it breaks, emits a SUSPECT message. It the connection is closed regularly, nothing happens. In both cases, a new member to be monitored will be chosen and monitoring continues (unless there are fewer than 2 members).

setProperties

public boolean setProperties(Properties props)

stop

public void stop()

up

public void up(Event evt)
Copyright ? 1998-2005 Bela Ban. All Rights Reserved.