Class XNetTrafficRouter

  • All Implemented Interfaces:
    java.util.EventListener, AbstractMRListener, XNetInterface, XNetListener

    public class XNetTrafficRouter
    extends XNetTrafficController
    implements XNetListener
    Implements an XNetInterface by doing a scatter-gather to another, simpler implementation.

    This is intended for remote operation, where only one copy of each message should go to/from another node. By putting a LnTrafficRouter implementation at the remote node, all of the routing of messages to multiple consumers can be done without traffic over the connection.

    • Method Detail

      • message

        public void message​(XNetReply m)
        Receive an XNet message from upstream and forward it to all the local clients.
        Specified by:
        message in interface XNetListener
        Parameters:
        m - The received XNet message. Note that this same object may be presented to multiple users. It should not be modified here.
      • message

        public void message​(XNetMessage l)
        Listen for the messages to the LI100/LI101.
        Specified by:
        message in interface XNetListener
        Parameters:
        l - The received XNet message. Note that this same object may be presented to multiple users. It should not be modified here.
      • notifyTimeout

        public void notifyTimeout​(XNetMessage msg)
        Description copied from interface: XNetListener
        Member function invoked by an XNetInterface implementation to notify a sender that an outgoing message timed out and was dropped from the queue.
        Specified by:
        notifyTimeout in interface XNetListener
        Parameters:
        msg - message which has timed out.
      • connect

        public void connect​(XNetInterface i)
        Make connection to existing XNetInterface object for upstream communication.
        Parameters:
        i - Interface to be connected
      • disconnectPort

        public void disconnectPort​(XNetInterface i)
        Break connection to upstream LocoNetInterface object. Once broken, attempts to send via "message" member will fail.
        Parameters:
        i - previously connected interface
      • notify

        protected void notify​(XNetReply m)
        Forward an XNetMessage to all registered listeners.
        Parameters:
        m - Message to forward. Listeners should not modify it!