Class FRAG4
- All Implemented Interfaces:
Lifecycle
Each fragment is identified by (a) the sender (part of the message to which the header is appended), (b) the fragmentation ID (which is unique (monotonically increasing) and (c) the fragement ID which ranges from 0 to number_of_fragments-1.
Requirement: lossless delivery (e.g. NAKACK2, UNICAST3). No requirement on ordering. Works for both unicast and multicast messages.
Compared to FRAG2, this protocol does not need to serialize the message in order to break
it into smaller fragments: if the message is a BytesMessage, then we send all fragments with a reference to
the original message's byte array, plus and offset and length. Otherwise, we use a number of FragmentedMessage
instances, with a reference to the original message and also an offset and length. These serialize messages at the
last possible moment, just before being sent by the transport.
- Version:
- 5.0
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jgroups.protocols.FRAG2
FRAG2.FragEntry -
Field Summary
Fields inherited from class org.jgroups.protocols.FRAG2
avg_size_down, avg_size_up, curr_id, fragment_list, HAS_FRAG_HEADER, members, msg_factoryFields inherited from class org.jgroups.protocols.Fragmentation
frag_size, num_frags_received, num_frags_sentFields inherited from class org.jgroups.stack.Protocol
after_creation_hook, down_prot, ergonomics, id, local_addr, log, policies, stack, stats, up_prot -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected MessageassembleMessage(Message[] fragments, boolean needs_deserialization, FragHeader hdr) Assembles all the message fragments into one message.protected voidSend all fragments as separate messages (with same ID !).Methods inherited from class org.jgroups.protocols.FRAG2
clearAllFragments, clearFragmentsFor, down, down, getAvgSizeDown, getAvgSizeUp, getNextId, handleViewChange, init, resetStats, unfragment, up, up, upMethods inherited from class org.jgroups.protocols.Fragmentation
getFragSize, getNumberOfReceivedFragments, getNumberOfSentFragments, setFragSizeMethods inherited from class org.jgroups.stack.Protocol
accept, addPolicy, addr, addr, afterCreationHook, destroy, down, enableStats, getAddress, getComponents, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getPolicies, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, policies, providedDownServices, providedUpServices, removePolicy, requiredDownServices, requiredUpServices, resetStatistics, setAddress, setDownProtocol, setErgonomics, setId, setLevel, setPolicies, setProtocolStack, setSocketFactory, setUpProtocol, setValue, start, statsEnabled, stop, toString
-
Constructor Details
-
FRAG4
public FRAG4()
-
-
Method Details
-
fragment
Description copied from class:FRAG2Send all fragments as separate messages (with same ID !). Example:Given the generated ID is 2344, number of fragments=3, message {dst,src,buf} would be fragmented into: [2344,3,0]{dst,src,buf1}, [2344,3,1]{dst,src,buf2} and [2344,3,2]{dst,src,buf3} -
assembleMessage
protected Message assembleMessage(Message[] fragments, boolean needs_deserialization, FragHeader hdr) throws Exception Description copied from class:FRAG2Assembles all the message fragments into one message. This method does not check if the fragmentation is complete (useFRAG2.FragEntry.isComplete()to verify) before calling this method)- Overrides:
assembleMessagein classFRAG2- Returns:
- the complete message
- Throws:
Exception
-