public class GzipInterceptor extends ChannelInterceptorBase implements GzipInterceptorMBean
ChannelInterceptor.InterceptorEvent| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_BUFFER_SIZE |
static int |
DEFAULT_OPTION_COMPRESSION_ENABLE |
protected static StringManager |
sm |
optionFlag| Constructor and Description |
|---|
GzipInterceptor() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
compress(byte[] data) |
static byte[] |
decompress(byte[] data) |
long |
getCompressedSizeRX() |
long |
getCompressedSizeTX() |
int |
getCompressionMinSize() |
int |
getCount() |
int |
getCountCompressedRX() |
int |
getCountCompressedTX() |
int |
getCountUncompressedRX() |
int |
getCountUncompressedTX() |
int |
getInterval() |
long |
getSizeRX() |
long |
getSizeTX() |
boolean |
getStatsEnabled() |
long |
getUncompressedSizeRX() |
long |
getUncompressedSizeTX() |
void |
messageReceived(ChannelMessage msg)
the
messageReceived is invoked when a message is received. |
void |
report() |
void |
reset() |
void |
sendMessage(Member[] destination,
ChannelMessage msg,
InterceptorPayload payload)
The
sendMessage method is called when a message is being sent to one more destinations. |
void |
setCompressionMinSize(int compressionMinSize)
Set the minimum payload size for compression to be enabled.
|
void |
setInterval(int interval)
If statistics collection is enabled, set the number of messages between
statistics reports being written to the log.
|
void |
setStatsEnabled(boolean statsEnabled)
Configure whether the interceptor collects statistics.
|
fireInterceptorEvent, getChannel, getLocalMember, getMember, getMembers, getNext, getOptionFlag, getPrevious, hasMembers, heartbeat, memberAdded, memberDisappeared, okToProcess, setChannel, setNext, setOptionFlag, setPrevious, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetOptionFlag, setOptionFlagprotected static final StringManager sm
public static final int DEFAULT_BUFFER_SIZE
public static final int DEFAULT_OPTION_COMPRESSION_ENABLE
public void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException
ChannelInterceptorsendMessage method is called when a message is being sent to one more destinations.
The interceptor can modify any of the parameters and then pass on the message down the stack by
invoking getNext().sendMessage(destination,msg,payload)getNext().sendMessage(destination,msg,payload)sendMessage in interface ChannelInterceptorsendMessage in class ChannelInterceptorBasedestination - Member[] - the destination for this messagemsg - ChannelMessage - the message to be sentpayload - InterceptorPayload - the payload, carrying an error handler and future useful data, can be nullChannelException - if a serialization error happens.ErrorHandler,
InterceptorPayloadpublic void messageReceived(ChannelMessage msg)
ChannelInterceptormessageReceived is invoked when a message is received.
ChannelMessage.getAddress() is the sender, or the reply-to address
if it has been overwritten.messageReceived in interface ChannelInterceptormessageReceived in class ChannelInterceptorBasemsg - ChannelMessagepublic static byte[] compress(byte[] data)
throws java.io.IOException
java.io.IOExceptionpublic static byte[] decompress(byte[] data)
throws java.io.IOException
data - Data to decompressjava.io.IOException - Compression errorpublic void report()
report in interface GzipInterceptorMBeanpublic int getCompressionMinSize()
getCompressionMinSize in interface GzipInterceptorMBeanpublic void setCompressionMinSize(int compressionMinSize)
GzipInterceptorMBeansetCompressionMinSize in interface GzipInterceptorMBeancompressionMinSize - The new minimum payload sizepublic boolean getStatsEnabled()
getStatsEnabled in interface GzipInterceptorMBeantrue if the interceptor is configured to collect
statistics, otherwise falsepublic void setStatsEnabled(boolean statsEnabled)
GzipInterceptorMBeansetStatsEnabled in interface GzipInterceptorMBeanstatsEnabled - true to enable statistics collections,
otherwise falsepublic int getInterval()
getInterval in interface GzipInterceptorMBeanpublic void setInterval(int interval)
GzipInterceptorMBeansetInterval in interface GzipInterceptorMBeaninterval - The new interval between reportspublic int getCount()
getCount in interface GzipInterceptorMBeanpublic int getCountCompressedTX()
getCountCompressedTX in interface GzipInterceptorMBeanpublic int getCountUncompressedTX()
getCountUncompressedTX in interface GzipInterceptorMBeanpublic int getCountCompressedRX()
getCountCompressedRX in interface GzipInterceptorMBeanpublic int getCountUncompressedRX()
getCountUncompressedRX in interface GzipInterceptorMBeanpublic long getSizeTX()
getSizeTX in interface GzipInterceptorMBeanpublic long getCompressedSizeTX()
getCompressedSizeTX in interface GzipInterceptorMBeanpublic long getUncompressedSizeTX()
getUncompressedSizeTX in interface GzipInterceptorMBeanpublic long getSizeRX()
getSizeRX in interface GzipInterceptorMBeanpublic long getCompressedSizeRX()
getCompressedSizeRX in interface GzipInterceptorMBeanpublic long getUncompressedSizeRX()
getUncompressedSizeRX in interface GzipInterceptorMBeanpublic void reset()
reset in interface GzipInterceptorMBeanCopyright © 2000-2019 Apache Software Foundation. All Rights Reserved.