Class FragmentationInterceptor.FragCollection
java.lang.Object
org.apache.catalina.tribes.group.interceptors.FragmentationInterceptor.FragCollection
- Enclosing class:
FragmentationInterceptor
Collection that holds the fragments of a message for reassembly.
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new fragment collection for the given message. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddMessage(ChannelMessage msg) Adds a fragment message to this collection.assemble()Assembles all fragments into a single complete message.Assembles the complete message if all fragments have been received and this collection has not been assembled before.booleancomplete()Checks if all fragments have been received.booleanexpired(long expire) Checks if this fragment collection has expired.
-
Constructor Details
-
FragCollection
Creates a new fragment collection for the given message.- Parameters:
msg- The channel message containing fragment metadata
-
-
Method Details
-
addMessage
Adds a fragment message to this collection.- Parameters:
msg- The fragment message to add
-
complete
public boolean complete()Checks if all fragments have been received.- Returns:
trueif all fragments are present
-
assemble
Assembles all fragments into a single complete message.- Returns:
- The assembled channel message
- Throws:
IllegalStateException- if not all fragments have been received
-
assembleIfComplete
Assembles the complete message if all fragments have been received and this collection has not been assembled before. The one-shot guarantee makes the completion of a message delivered exactly once, even when the last fragments are processed concurrently on multiple threads.- Returns:
- The assembled channel message, or
nullif the message is incomplete or was assembled by an earlier call
-
expired
public boolean expired(long expire) Checks if this fragment collection has expired.- Parameters:
expire- The expiration time in milliseconds- Returns:
trueif the collection has expired
-