Class NamedTopicEvent

java.lang.Object
java.util.EventObject
com.tangosol.net.topic.NamedTopicEvent
All Implemented Interfaces:
PortableObject, Serializable

public class NamedTopicEvent extends EventObject implements PortableObject
An event related to a NamedTopic.
Author:
Jonathan Knight 2024.11.26
See Also:
  • Field Details

  • Constructor Details

    • NamedTopicEvent

      public NamedTopicEvent()
      Default constructor for serialization.
    • NamedTopicEvent

      public NamedTopicEvent(NamedTopic<?> source, NamedTopicEvent.Type type)
      Create an event.
      Parameters:
      source - the source of the event
      type - the type of the event
  • Method Details

    • getSource

      public NamedTopic<?> getSource()
      Overrides:
      getSource in class EventObject
    • getType

      public NamedTopicEvent.Type getType()
      Returns the type of the event.
      Returns:
      the type of the event
    • readExternal

      public void readExternal(PofReader in) throws IOException
      Description copied from interface: PortableObject
      Restore the contents of a user type instance by reading its state using the specified PofReader object.
      Specified by:
      readExternal in interface PortableObject
      Parameters:
      in - the PofReader from which to read the object's state
      Throws:
      IOException - if an I/O error occurs
    • writeExternal

      public void writeExternal(PofWriter out) throws IOException
      Description copied from interface: PortableObject
      Save the contents of a POF user type instance by writing its state using the specified PofWriter object.
      Specified by:
      writeExternal in interface PortableObject
      Parameters:
      out - the PofWriter to which to write the object's state
      Throws:
      IOException - if an I/O error occurs
    • toString

      public String toString()
      Return a String representation of this MapEvent object.
      Overrides:
      toString in class EventObject
      Returns:
      a String representation of this MapEvent object
    • dispatch

      public void dispatch(Listeners listeners)
      Dispatch this event to the specified listener collection.

      This call is equivalent to

         dispatch(listeners, true);
       
      Parameters:
      listeners - the listeners collection
      Throws:
      ClassCastException - if any of the targets is not an instance of MapListener interface
    • dispatch

      public void dispatch(Listeners listeners, boolean fStrict)
      Dispatch this event to the specified listener collection.
      Parameters:
      listeners - the listeners collection
      fStrict - if true then any RuntimeException thrown by event handlers stops all further event processing and the exception is re-thrown; if false then all exceptions are logged and the process continues
      Throws:
      ClassCastException - if any of the targets is not an instance of MapListener interface
    • dispatch

      public void dispatch(NamedTopicListener listener)
      Dispatch this event to the specified MapListener.
      Parameters:
      listener - the listener
    • shouldDispatch

      protected boolean shouldDispatch(NamedTopicListener listener)
      Return true if the provided MapListener should receive this event.
      Parameters:
      listener - the MapListener to dispatch this event to
      Returns:
      true if the provided MapListener should receive the event
    • replaceSource

      public NamedTopicEvent replaceSource(NamedTopic<?> source)
      Create a new NamedTopicEvent the same as this event, but with a different source.
      Parameters:
      source - the new event source
      Returns:
      a new NamedTopicEvent the same as this event, but with a different source
      Throws:
      NullPointerException - if the source parameter is null