Interface HostSide

  • All Known Implementing Classes:
    AbstractCodec, AbstractSimpleCodec

    public interface HostSide
    Used by transport and codec plug-in authors for sending messages towards the host (originating from the transport). This interface is used to represent as the next element in a connectivity plug-in chain, and forms part of the interface for a codec.
    • Method Detail

      • sendBatchTowardsHost

        void sendBatchTowardsHost​(java.util.List<Message> messages)
        Process or deliver a batch of messages heading towards the host. Messages should be processed and passed to the next connectivity plug-in in the chain, which is typically provided by the AbstractCodec.setNextTowardsHost(HostSide) or AbstractTransport.setNextTowardsHost(HostSide) method.

        The ability to handle messages in batches is provided to allow amortising the costs of delivering events. Consider using Collections.singletonList(Object) if not required.

        Threading: Plug-ins are required to ensure that they do not call into the next plug-in in their chain from more than one thread concurrently (although it does not have to be the same thread each time). Plug-ins may therefore assume that no additional locking is required in this method to protect access to the plug-in's state. The plug-in should be as responsive as possible to the ConnectivityPlugin.shutdown() method, which may be called at any time on any thread. If this method throws then the exception will be logged and the batch of messages dropped.