Class SerialPeer

    • Nested Class Summary

      • Nested classes/interfaces inherited from interface org.refcodes.mixin.LocatorAccessor

        org.refcodes.mixin.LocatorAccessor.LocatorBuilder<T extends Object,​B extends org.refcodes.mixin.LocatorAccessor.LocatorBuilder<T,​B>>, org.refcodes.mixin.LocatorAccessor.LocatorMutator<T extends Object>, org.refcodes.mixin.LocatorAccessor.LocatorProperty<T extends Object>
    • Field Summary

      • Fields inherited from class org.refcodes.p2p.AbstractPeer

        _locator, _messageConsumer, _peerRouter
    • Constructor Summary

      Constructors 
      Constructor Description
      SerialPeer​(Integer aLocator, SerialP2PMessageConsumer aMessageConsumer, org.refcodes.serial.Port<?>... aPorts)
      Constructs the Peer instance with the given locator identifying the Peer and the given P2PMessageConsumer processing the messages targeted at the given locator binding the given Port instances.
      SerialPeer​(Integer aLocator, SerialP2PMessageConsumer aMessageConsumer, org.refcodes.serial.TransmissionMetrics aTransmissionMetrics, ExecutorService aExecutorService, org.refcodes.serial.Port<?>... aPorts)
      Constructs the Peer instance with the given locator identifying the Peer and the given P2PMessageConsumer processing the messages targeted at the given locator binding the given Port instances.
      SerialPeer​(Integer aLocator, SerialP2PMessageConsumer aMessageConsumer, org.refcodes.serial.TransmissionMetrics aTransmissionMetrics, org.refcodes.serial.Port<?>... aPorts)
      Constructs the Peer instance with the given locator identifying the Peer and the given P2PMessageConsumer processing the messages targeted at the given locator binding the given Port instances.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void sendMessage​(int aDestination, org.refcodes.serial.Segment aPayload)
      Convenience method for AbstractPeer.sendMessage(P2PMessage).
      void sendMessage​(int aDestination, org.refcodes.serial.Sequence aPayload)
      Convenience method for AbstractPeer.sendMessage(P2PMessage).
      <P> void sendMessage​(Integer aDestination, P aPayload)
      • Methods inherited from class org.refcodes.p2p.AbstractPeer

        addPeerRouter, getHopCount, getLocator, peerRouters, removePeerRouter, sendMessage, toString
      • Methods inherited from interface org.refcodes.mixin.LocatorAccessor

        getLocator
      • Methods inherited from interface org.refcodes.p2p.Peer

        addPeerRouter, peerRouters, removePeerRouter
      • Methods inherited from interface org.refcodes.p2p.PeerRouter

        getHopCount, getHopCount, sendMessage
    • Constructor Detail

      • SerialPeer

        public SerialPeer​(Integer aLocator,
                          SerialP2PMessageConsumer aMessageConsumer,
                          org.refcodes.serial.Port<?>... aPorts)
        Constructs the Peer instance with the given locator identifying the Peer and the given P2PMessageConsumer processing the messages targeted at the given locator binding the given Port instances.
        Parameters:
        aLocator - The LOCATOR of the Peer being constructed. Messages targeted to this Peer will be addressed to the given LOCATOR.
        aMessageConsumer - The consumer (being the functional P2PMessageConsumer interface) of the P2PMessage instances targeted at this Peer instance.
        aPorts - The Port instances to which to attach.
      • SerialPeer

        public SerialPeer​(Integer aLocator,
                          SerialP2PMessageConsumer aMessageConsumer,
                          org.refcodes.serial.TransmissionMetrics aTransmissionMetrics,
                          org.refcodes.serial.Port<?>... aPorts)
        Constructs the Peer instance with the given locator identifying the Peer and the given P2PMessageConsumer processing the messages targeted at the given locator binding the given Port instances.
        Parameters:
        aLocator - The LOCATOR of the Peer being constructed. Messages targeted to this Peer will be addressed to the given LOCATOR.
        aMessageConsumer - The consumer (being the functional P2PMessageConsumer interface) of the P2PMessage instances targeted at this Peer instance.
        aTransmissionMetrics - The TransmissionMetrics to use when setting up the peer.
        aPorts - The Port instances to which to attach.
      • SerialPeer

        public SerialPeer​(Integer aLocator,
                          SerialP2PMessageConsumer aMessageConsumer,
                          org.refcodes.serial.TransmissionMetrics aTransmissionMetrics,
                          ExecutorService aExecutorService,
                          org.refcodes.serial.Port<?>... aPorts)
        Constructs the Peer instance with the given locator identifying the Peer and the given P2PMessageConsumer processing the messages targeted at the given locator binding the given Port instances.
        Parameters:
        aLocator - The LOCATOR of the Peer being constructed. Messages targeted to this Peer will be addressed to the given LOCATOR.
        aMessageConsumer - The consumer (being the functional P2PMessageConsumer interface) of the P2PMessage instances targeted at this Peer instance.
        aTransmissionMetrics - The TransmissionMetrics to use when setting up the peer.
        aExecutorService - The ExecutorService to be used when creating Thread instances for handling input and output data simultaneously.
        aPorts - The Port instances to which to attach.
    • Method Detail

      • sendMessage

        public void sendMessage​(int aDestination,
                                org.refcodes.serial.Segment aPayload)
                         throws IOException,
                                org.refcodes.p2p.NoSuchDestinationException
        Convenience method for AbstractPeer.sendMessage(P2PMessage).
        Parameters:
        aDestination - The destination of the message.
        aPayload - The payload to be sent.
        Throws:
        org.refcodes.p2p.NoSuchDestinationException - thrown in case there is none such destination peer.
        IOException - thrown in case I/O problems occurred while accessing the mesh.
      • sendMessage

        public void sendMessage​(int aDestination,
                                org.refcodes.serial.Sequence aPayload)
                         throws IOException,
                                org.refcodes.p2p.NoSuchDestinationException
        Convenience method for AbstractPeer.sendMessage(P2PMessage).
        Parameters:
        aDestination - The destination of the message.
        aPayload - The payload to be sent.
        Throws:
        org.refcodes.p2p.NoSuchDestinationException - thrown in case there is none such destination peer.
        IOException - thrown in case I/O problems occurred while accessing the mesh.