Class VMCommSystem

  • All Implemented Interfaces:
    Service

    public class VMCommSystem
    extends CommSystemFacade
    Hacked up in-VM comm system for talking between contexts. It doesn't even generate any routerAddresses, but instead tracks the peers through a singleton. Currently, the comm system doesn't even inject any lag, though it could (later). It does honor the standard transport stats though, but not the TCP specific ones. FOR DEBUGGING AND LOCAL TESTING ONLY.
    • Constructor Detail

    • Method Detail

      • countActivePeers

        public int countActivePeers()
        Description copied from class: CommSystemFacade
        How many peers are we currently connected to, that we have sent a message to or received a message from in the last five minutes.
        Specified by:
        countActivePeers in class CommSystemFacade
      • countActiveSendPeers

        public int countActiveSendPeers()
        Description copied from class: CommSystemFacade
        How many peers are we currently connected to, that we have sent a message to in the last minute. Unused for anything, to be removed.
        Specified by:
        countActiveSendPeers in class CommSystemFacade
      • getEstablished

        public Set<Hash> getEstablished()
        Description copied from class: CommSystemFacade
        Get all the peers we are connected to. This should be more efficient than repeated calls to isEstablished() if you have to check a lot.
        Specified by:
        getEstablished in class CommSystemFacade
        Returns:
        the hashes of all the routers we are connected to, non-null
      • processMessage

        public void processMessage​(OutNetMessage msg)
        The router wants us to send the given message to the peer. Do so, or fire off the failing job.
        Specified by:
        processMessage in class CommSystemFacade
      • receive

        public void receive​(byte[] message,
                            Hash fromPeer)
        We send messages between comms as bytes so that we strip any router-local info. For example, a router tags the # attempts to send through a leaseSet, what type of tunnel a tunnelId is bound to, etc.
      • shutdown

        public void shutdown()
        Description copied from interface: Service
        Instruct the service that the router is shutting down and that it should do whatever is necessary to go down gracefully. It should not depend on other components at this point. This call DOES block.
      • startup

        public void startup()
        Description copied from interface: Service
        Instruct the service that it should start normal operation. This call DOES block until the service is ready.
      • restart

        public void restart()
        Description copied from interface: Service
        Perform a soft restart.