org.jgroups.protocols

Class FC


public class FC
extends Protocol

Simple flow control protocol based on a credit system. Each sender has a number of credits (bytes to send). When the credits have been exhausted, the sender blocks. Each receiver also keeps track of how many credits it has received from a sender. When credits for a sender fall below a threshold, the receiver sends more credits to the sender. Works for both unicast and multicast messages.

Note that this protocol must be located towards the top of the stack, or all down_threads from JChannel to this protocol must be set to false ! This is in order to block JChannel.send()/JChannel.down().
This is the second simplified implementation of the same model. The algorithm is sketched out in doc/FlowControl.txt

Version:
$Revision: 1.50 $
Author:
Bela Ban

Nested Class Summary

static class
FC.FcHeader

Field Summary

Fields inherited from class org.jgroups.stack.Protocol

down_handler, down_prot, down_queue, down_thread, down_thread_prio, log, observer, props, stack, stats, trace, up_handler, up_prot, up_queue, up_thread, up_thread_prio, warn

Method Summary

void
down(Event evt)
Map
dumpStats()
double
getAverageTimeBlocked()
long
getMaxBlockTime()
long
getMaxCredits()
long
getMinCredits()
double
getMinThreshold()
String
getName()
int
getNumberOfBlockings()
int
getNumberOfCreditRequestsReceived()
int
getNumberOfCreditRequestsSent()
int
getNumberOfCreditResponsesReceived()
int
getNumberOfCreditResponsesSent()
long
getTotalTimeBlocked()
boolean
isBlocked()
String
printCredits()
String
printReceiverCredits()
String
printSenderCredits()
protected void
receiveDownEvent(Event evt)
We need to receive view changes concurrent to messages on the down events: a message might blocks, e.g.
void
resetStats()
void
setMaxBlockTime(long t)
void
setMaxCredits(long max_credits)
void
setMinCredits(long min_credits)
void
setMinThreshold(double min_threshold)
boolean
setProperties(Properties props)
String
showLastBlockingTimes()
void
start()
void
stop()
void
unblock()
Allows to unblock a blocked sender from an external program, e.g.
void
up(Event evt)

Methods inherited from class org.jgroups.stack.Protocol

destroy, down, downThreadEnabled, dumpStats, enableStats, getDownProtocol, getDownQueue, getName, getProperties, getUpProtocol, getUpQueue, handleSpecialDownEvent, init, isTrace, isWarn, passDown, passUp, printStats, providedDownServices, providedUpServices, receiveDownEvent, receiveUpEvent, requiredDownServices, requiredUpServices, resetStats, setDownProtocol, setObserver, setProperties, setPropertiesInternal, setProtocolStack, setTrace, setUpProtocol, setWarn, start, startDownHandler, startUpHandler, statsEnabled, stop, stopInternal, up, upThreadEnabled

Method Details

down

public void down(Event evt)
Overrides:
down in interface Protocol

dumpStats

public Map dumpStats()
Overrides:
dumpStats in interface Protocol

getAverageTimeBlocked

public double getAverageTimeBlocked()

getMaxBlockTime

public long getMaxBlockTime()

getMaxCredits

public long getMaxCredits()

getMinCredits

public long getMinCredits()

getMinThreshold

public double getMinThreshold()

getName

public final String getName()
Overrides:
getName in interface Protocol

getNumberOfBlockings

public int getNumberOfBlockings()

getNumberOfCreditRequestsReceived

public int getNumberOfCreditRequestsReceived()

getNumberOfCreditRequestsSent

public int getNumberOfCreditRequestsSent()

getNumberOfCreditResponsesReceived

public int getNumberOfCreditResponsesReceived()

getNumberOfCreditResponsesSent

public int getNumberOfCreditResponsesSent()

getTotalTimeBlocked

public long getTotalTimeBlocked()

isBlocked

public boolean isBlocked()

printCredits

public String printCredits()

printReceiverCredits

public String printReceiverCredits()

printSenderCredits

public String printSenderCredits()

receiveDownEvent

protected void receiveDownEvent(Event evt)
We need to receive view changes concurrent to messages on the down events: a message might blocks, e.g. because we don't have enough credits to send to member P. However, if member P crashed, we need to unblock !
Overrides:
receiveDownEvent in interface Protocol
Parameters:
evt -

resetStats

public void resetStats()
Overrides:
resetStats in interface Protocol

setMaxBlockTime

public void setMaxBlockTime(long t)

setMaxCredits

public void setMaxCredits(long max_credits)

setMinCredits

public void setMinCredits(long min_credits)

setMinThreshold

public void setMinThreshold(double min_threshold)

setProperties

public boolean setProperties(Properties props)
Overrides:
setProperties in interface Protocol

showLastBlockingTimes

public String showLastBlockingTimes()

start

public void start()
            throws Exception
Overrides:
start in interface Protocol

stop

public void stop()
Overrides:
stop in interface Protocol

unblock

public void unblock()
Allows to unblock a blocked sender from an external program, e.g. JMX

up

public void up(Event evt)
Overrides:
up in interface Protocol

Copyright B) 1998-2005 Bela Ban. All Rights Reserved.