Package org.jgroups.protocols
Class COMPRESS
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.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.19.4.1 2008/11/28 06:08:35 belaban Exp $
- Author:
- Bela Ban
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
COMPRESS.CompressHeader
-
Constructor Summary
Constructors Constructor Description COMPRESS()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
This method is called on aChannel.close()
.java.lang.Object
down(Event evt)
We compress the payload if it is larger thanmin_size
.java.lang.String
getName()
void
init()
Called after instance has been created (null constructor) and before protocol is started.boolean
setProperties(java.util.Properties props)
Configures the protocol initially.java.lang.Object
up(Event evt)
If there is no header, we pass the message up.-
Methods inherited from class org.jgroups.stack.Protocol
downThreadEnabled, dumpStats, enableStats, getDownProtocol, getProperties, getProtocolStack, getThreadFactory, getTransport, getUpProtocol, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStats, setDownProtocol, setPropertiesInternal, setProtocolStack, setUpProtocol, start, statsEnabled, stop, upThreadEnabled
-
-
-
-
Method Detail
-
init
public void init() throws java.lang.Exception
Description copied from class:Protocol
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.
-
destroy
public void destroy()
Description copied from class:Protocol
This method is called on aChannel.close()
. Does some cleanup; after the call the VM will terminate
-
setProperties
public boolean setProperties(java.util.Properties props)
Description copied from class:Protocol
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 classProtocol
-
down
public java.lang.Object down(Event evt)
We compress the payload if it is larger thanmin_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)
-
-