Package org.jgroups

Interface MessageFactory

All Known Implementing Classes:
DefaultMessageFactory

public interface MessageFactory
Since:
5.0
  • Method Summary

    Modifier and Type
    Method
    Description
    <T extends Message>
    T
    create(short id)
    Creates a message based on the given ID
    <M extends MessageFactory>
    M
    register(short type, Supplier<? extends Message> generator)
    Registers a new creator of messages
  • Method Details

    • create

      <T extends Message> T create(short id)
      Creates a message based on the given ID
      Type Parameters:
      T - The type of the message
      Parameters:
      id - The ID
      Returns:
      A message
    • register

      <M extends MessageFactory> M register(short type, Supplier<? extends Message> generator)
      Registers a new creator of messages
      Parameters:
      type - The type associated with the new payload. Needs to be the same in all nodes of the same cluster, and needs to be available (ie., not taken by JGroups or other applications).
      generator - The creator of the payload associated with the given type