org.jgroups.protocols

Class COMPRESS


public class COMPRESS
extends Protocol

Compresses the payload of a message. Goal is to reduce the number of messages sent across the wire. Should ideally be layered somewhere above a fragmentation protocol (e.g. FRAG).
Version:
$Id: COMPRESS.java,v 1.10 2005/11/03 11:42:59 belaban Exp $
Author:
Bela Ban

Nested Class Summary

static class
COMPRESS.CompressHeader

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
destroy()
This method is called on a Channel.close().
void
down(Event evt)
We compress the payload if it is larger than min_size.
String
getName()
void
init()
Called after instance has been created (null constructor) and before protocol is started.
boolean
setProperties(Properties props)
Configures the protocol initially.
void
up(Event evt)
If there is no header, we pass the message up.

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

destroy

public void destroy()
This method is called on a Channel.close(). Does some cleanup; after the call the VM will terminate
Overrides:
destroy in interface Protocol

down

public void down(Event evt)
We compress the payload if it is larger than min_size. In this case we add a header containing the original size before compression. Otherwise we add no header.
Note that we compress either the entire buffer (if offset/length are not used), or a subset (if offset/length are used)
Overrides:
down in interface Protocol
Parameters:
evt -

getName

public String getName()
Overrides:
getName in interface Protocol

init

public void init()
            throws Exception
Called after instance has been created (null constructor) and before protocol is started. Properties are already set. Other protocols are not yet connected and events cannot yet be sent.
Overrides:
init in interface Protocol

setProperties

public boolean setProperties(Properties props)
Configures the protocol initially. A configuration string consists of name=value items, separated by a ';' (semicolon), e.g.:
 "loopback=false;unicast_inport=4444"
 
Overrides:
setProperties in interface Protocol

up

public void up(Event evt)
If there is no header, we pass the message up. Otherwise we uncompress the payload to its original size.
Overrides:
up in interface Protocol
Parameters:
evt -

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