org.jgroups.protocols

Class FRAG


public class FRAG
extends Protocol

Fragmentation layer. Fragments messages larger than FRAG_SIZE into smaller packets. Reassembles fragmented packets into bigger ones. The fragmentation number is prepended to the messages as a header (and removed at the receiving side).

Each fragment is identified by (a) the sender (part of the message to which the header is appended), (b) the fragmentation ID (which is unique per FRAG layer (monotonically increasing) and (c) the fragement ID which ranges from 0 to number_of_fragments-1.

Requirement: lossless delivery (e.g. NAK, ACK). No requirement on ordering. Works for both unicast and multicast messages.

Version:
$Id: FRAG.java,v 1.28.2.1 2006/05/16 05:14:08 belaban Exp $
Authors:
Bela Ban
Filip Hanik

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)
Fragment a packet if larger than frag_size (add a header).
int
getFragSize()
String
getName()
long
getNumberOfReceivedFragments()
long
getNumberOfReceivedMessages()
long
getNumberOfSentFragments()
long
getNumberOfSentMessages()
void
resetStats()
void
setFragSize(int s)
boolean
setProperties(Properties props)
Setup the Protocol instance acording to the configuration string
void
up(Event evt)
If event is a message, if it is fragmented, re-assemble fragments into big message and pass up the stack.

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)
Fragment a packet if larger than frag_size (add a header). Otherwise just pass down. Only add a header if framentation is needed !
Overrides:
down in interface Protocol

getFragSize

public int getFragSize()

getName

public String getName()
Overrides:
getName in interface Protocol

getNumberOfReceivedFragments

public long getNumberOfReceivedFragments()

getNumberOfReceivedMessages

public long getNumberOfReceivedMessages()

getNumberOfSentFragments

public long getNumberOfSentFragments()

getNumberOfSentMessages

public long getNumberOfSentMessages()

resetStats

public void resetStats()
Overrides:
resetStats in interface Protocol

setFragSize

public void setFragSize(int s)

setProperties

public boolean setProperties(Properties props)
Setup the Protocol instance acording to the configuration string
Overrides:
setProperties in interface Protocol

up

public void up(Event evt)
If event is a message, if it is fragmented, re-assemble fragments into big message and pass up the stack.
Overrides:
up in interface Protocol

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