net.sf.ehcache.distribution
Class PayloadUtil
final
class
PayloadUtil
extends Object
This class provides utility methods for assembling and disassembling a heartbeat payload.
Care is taken to fit the payload into the MTU of ethernet, which is 1500 bytes.
The algorithms in this class are capable of creating payloads for CacheManagers containing
approximately 500 caches to be replicated.
Version: $Id: PayloadUtil.java 70 2006-05-07 11:50:02Z gregluck $
Author: Greg Luck
Method Summary |
static byte[] | assembleUrlList(List localCachePeers)
Assembles a list of URLs
|
static byte[] | gzip(byte[] ungzipped)
Gzips a byte[]. |
static byte[] | ungzip(byte[] gzipped)
The fastest Ungzip implementation. |
public static final int MTU
The maximum transmission unit. This varies by link layer. For ethernet, fast ethernet and
gigabit ethernet it is 1500 bytes, the value chosen.
Payloads are limited to this so that there is no fragmentation and no necessity for a complex
reassembly protocol.
public static final String URL_DELIMITER
Delmits URLS sent via heartbeats over sockets
public static byte[] assembleUrlList(List localCachePeers)
Assembles a list of URLs
Parameters: localCachePeers
Returns: an uncompressed payload with catenated rmiUrls.
public static byte[] gzip(byte[] ungzipped)
Gzips a byte[]. For text, approximately 10:1 compression is achieved.
Parameters: ungzipped the bytes to be gzipped
Returns: gzipped bytes
public static byte[] ungzip(byte[] gzipped)
The fastest Ungzip implementation. See PageInfoTest in ehcache-constructs.
A high performance implementation, although not as fast as gunzip3.
gunzips 100000 of ungzipped content in 9ms on the reference machine.
It does not use a fixed size buffer and is therefore suitable for arbitrary
length arrays.
Parameters: gzipped
Returns: a plain, uncompressed byte[]