Class DispatcherSupplier


  • public class DispatcherSupplier
    extends Object
    This is a means to manage and supply dispatchers to your ClientController that serialize or deseralize the client instances. This is not required by all ClientControllers.
    • Constructor Detail

      • DispatcherSupplier

        public DispatcherSupplier()
    • Method Detail

      • add

        public void add​(Dispatcher dispatcher)
        Add a singleton dispatcher, this will not instantiate a new dispatcher when required but reuse the same one throughout the application lifetime.
        Parameters:
        dispatcher - The dispatcher to add.
      • add

        public void add​(String id,
                        Supplier<Dispatcher> supplier)
        Add a dispatcher to map serialized clients dispatchers to. This will be used when serializing a client to obtain the actual dispatcher.
        Parameters:
        id - The ID of the dispatcher, the serialized client should store this.
        supplier - How to create an instance of this dispatcher.
      • get

        public Dispatcher get​(String id)
        Get an instance of a Dispatcher of which it's supplier was added.
        Parameters:
        id - The ID of the dispatcher.
        Returns:
        An instantiated dispatcher instance.