Class MessageSlicer
java.lang.Object
org.opendaylight.controller.cluster.messaging.MessageSlicer
- All Implemented Interfaces:
AutoCloseable
This class slices messages into smaller chunks.
MessageAssembler
is used to re-assemble the messages.- Author:
- Thomas Pantelis
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic MessageSlicer.Builder
builder()
Returns a new Builder for creating MessageSlicer instances.void
cancelSlicing
(@NonNull Predicate<Identifier> filter) Cancels all in-progress sliced message state that matches the given filter.void
Checks for and removes sliced message state that has expired due to inactivity from the assembling component on the other end.void
close()
Closes and removes all in-progress sliced message state.boolean
handleMessage
(Object message) Invoked to handle messages pertaining to this class.static boolean
isHandledMessage
(Object message) Checks if the given message is handled by this class.boolean
slice
(SliceOptions options) Slices a message into chunks based on the serialized size, the maximum message slice size and the given options.
-
Field Details
-
DEFAULT_MAX_SLICING_TRIES
public static final int DEFAULT_MAX_SLICING_TRIES- See Also:
-
-
Method Details
-
builder
Returns a new Builder for creating MessageSlicer instances.- Returns:
- a Builder instance
-
isHandledMessage
Checks if the given message is handled by this class. If so, it should be forwarded to thehandleMessage(Object)
method- Parameters:
message
- the message to check- Returns:
- true if handled, false otherwise
-
slice
Slices a message into chunks based on the serialized size, the maximum message slice size and the given options.- Parameters:
options
- the SliceOptions- Returns:
- true if the message was sliced, false otherwise
-
handleMessage
Invoked to handle messages pertaining to this class.- Parameters:
message
- the message- Returns:
- true if the message was handled, false otherwise
-
checkExpiredSlicedMessageState
public void checkExpiredSlicedMessageState()Checks for and removes sliced message state that has expired due to inactivity from the assembling component on the other end. -
close
public void close()Closes and removes all in-progress sliced message state.- Specified by:
close
in interfaceAutoCloseable
-
cancelSlicing
Cancels all in-progress sliced message state that matches the given filter.- Parameters:
filter
- filters by Identifier
-