Class GzipInterceptor
java.lang.Object
org.apache.catalina.tribes.group.ChannelInterceptorBase
org.apache.catalina.tribes.group.interceptors.GzipInterceptor
- All Implemented Interfaces:
- ChannelInterceptor,- GzipInterceptorMBean,- Heartbeat,- MembershipListener
- 
Nested Class SummaryNested classes/interfaces inherited from interface org.apache.catalina.tribes.ChannelInterceptorChannelInterceptor.InterceptorEvent
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final intstatic final intprotected static final StringManagerFields inherited from class org.apache.catalina.tribes.group.ChannelInterceptorBaseoptionFlag
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic byte[]compress(byte[] data) static byte[]decompress(byte[] data) longlongintintgetCount()intintintintintlonglongbooleanlonglongvoidthemessageReceivedis invoked when a message is received.voidreport()voidreset()voidsendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) ThesendMessagemethod is called when a message is being sent to one more destinations.voidsetCompressionMinSize(int compressionMinSize) Set the minimum payload size for compression to be enabled.voidsetInterval(int interval) If statistics collection is enabled, set the number of messages between statistics reports being written to the log.voidsetStatsEnabled(boolean statsEnabled) Configure whether the interceptor collects statistics.Methods inherited from class org.apache.catalina.tribes.group.ChannelInterceptorBasefireInterceptorEvent, getChannel, getLocalMember, getMember, getMembers, getNext, getOptionFlag, getPrevious, hasMembers, heartbeat, memberAdded, memberDisappeared, okToProcess, setChannel, setNext, setOptionFlag, setPrevious, start, stopMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.catalina.tribes.group.interceptors.GzipInterceptorMBeangetOptionFlag, setOptionFlag
- 
Field Details- 
sm
- 
DEFAULT_BUFFER_SIZEpublic static final int DEFAULT_BUFFER_SIZE- See Also:
 
- 
DEFAULT_OPTION_COMPRESSION_ENABLEpublic static final int DEFAULT_OPTION_COMPRESSION_ENABLE- See Also:
 
 
- 
- 
Constructor Details- 
GzipInterceptorpublic GzipInterceptor()
 
- 
- 
Method Details- 
sendMessagepublic void sendMessage(Member[] destination, ChannelMessage msg, InterceptorPayload payload) throws ChannelException Description copied from interface:ChannelInterceptorThesendMessagemethod 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 invokinggetNext().sendMessage(destination,msg,payload)
 Alternatively the interceptor can stop the message from being sent by not invokinggetNext().sendMessage(destination,msg,payload)
 If the message is to be sent asynchronous the application can be notified of completion and errors by passing in an error handler attached to a payload object.
 The ChannelMessage.getAddress contains Channel.getLocalMember, and can be overwritten to simulate a message sent from another node.- Specified by:
- sendMessagein interface- ChannelInterceptor
- Overrides:
- sendMessagein class- ChannelInterceptorBase
- Parameters:
- destination- Member[] - the destination for this message
- msg- ChannelMessage - the message to be sent
- payload- InterceptorPayload - the payload, carrying an error handler and future useful data, can be null
- Throws:
- ChannelException- if a serialization error happens.
- See Also:
 
- 
messageReceivedDescription copied from interface:ChannelInterceptorthemessageReceivedis invoked when a message is received.ChannelMessage.getAddress()is the sender, or the reply-to address if it has been overwritten.- Specified by:
- messageReceivedin interface- ChannelInterceptor
- Overrides:
- messageReceivedin class- ChannelInterceptorBase
- Parameters:
- msg- ChannelMessage
 
- 
compress- Throws:
- IOException
 
- 
decompress- Parameters:
- data- Data to decompress
- Returns:
- Decompressed data
- Throws:
- IOException- Compression error
 
- 
reportpublic void report()- Specified by:
- reportin interface- GzipInterceptorMBean
 
- 
getCompressionMinSizepublic int getCompressionMinSize()- Specified by:
- getCompressionMinSizein interface- GzipInterceptorMBean
- Returns:
- the minimum payload size for compression to be enabled.
 
- 
setCompressionMinSizepublic void setCompressionMinSize(int compressionMinSize) Description copied from interface:GzipInterceptorMBeanSet the minimum payload size for compression to be enabled. A value of zero or less means compression will always be used. If not explicitly configured, a default of zero will be used.- Specified by:
- setCompressionMinSizein interface- GzipInterceptorMBean
- Parameters:
- compressionMinSize- The new minimum payload size
 
- 
getStatsEnabledpublic boolean getStatsEnabled()- Specified by:
- getStatsEnabledin interface- GzipInterceptorMBean
- Returns:
- trueif the interceptor is configured to collect statistics, otherwise- false
 
- 
setStatsEnabledpublic void setStatsEnabled(boolean statsEnabled) Description copied from interface:GzipInterceptorMBeanConfigure whether the interceptor collects statistics.- Specified by:
- setStatsEnabledin interface- GzipInterceptorMBean
- Parameters:
- statsEnabled-- trueto enable statistics collections, otherwise- false
 
- 
getIntervalpublic int getInterval()- Specified by:
- getIntervalin interface- GzipInterceptorMBean
- Returns:
- If statistics collection is enabled, the number of messages between statistics reports being written to the log.
 
- 
setIntervalpublic void setInterval(int interval) Description copied from interface:GzipInterceptorMBeanIf statistics collection is enabled, set the number of messages between statistics reports being written to the log. A value of zero or less means no statistics reports are written.- Specified by:
- setIntervalin interface- GzipInterceptorMBean
- Parameters:
- interval- The new interval between reports
 
- 
getCountpublic int getCount()- Specified by:
- getCountin interface- GzipInterceptorMBean
 
- 
getCountCompressedTXpublic int getCountCompressedTX()- Specified by:
- getCountCompressedTXin interface- GzipInterceptorMBean
 
- 
getCountUncompressedTXpublic int getCountUncompressedTX()- Specified by:
- getCountUncompressedTXin interface- GzipInterceptorMBean
 
- 
getCountCompressedRXpublic int getCountCompressedRX()- Specified by:
- getCountCompressedRXin interface- GzipInterceptorMBean
 
- 
getCountUncompressedRXpublic int getCountUncompressedRX()- Specified by:
- getCountUncompressedRXin interface- GzipInterceptorMBean
 
- 
getSizeTXpublic long getSizeTX()- Specified by:
- getSizeTXin interface- GzipInterceptorMBean
 
- 
getCompressedSizeTXpublic long getCompressedSizeTX()- Specified by:
- getCompressedSizeTXin interface- GzipInterceptorMBean
 
- 
getUncompressedSizeTXpublic long getUncompressedSizeTX()- Specified by:
- getUncompressedSizeTXin interface- GzipInterceptorMBean
 
- 
getSizeRXpublic long getSizeRX()- Specified by:
- getSizeRXin interface- GzipInterceptorMBean
 
- 
getCompressedSizeRXpublic long getCompressedSizeRX()- Specified by:
- getCompressedSizeRXin interface- GzipInterceptorMBean
 
- 
getUncompressedSizeRXpublic long getUncompressedSizeRX()- Specified by:
- getUncompressedSizeRXin interface- GzipInterceptorMBean
 
- 
resetpublic void reset()- Specified by:
- resetin interface- GzipInterceptorMBean
 
 
-