Class ServerTransport

    • Constructor Summary

      Constructors 
      Constructor Description
      ServerTransport()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.List<java.lang.Object> clusterMembers()
      Returns the addresses of all cluster members.
      java.lang.Object localAddress()
      Returns the local addres of this member.
      java.lang.String[] options()
      Prints the accepted options, e.g.
      void options​(java.lang.String... options)
      Sets options on this transport.
      void receive​(Address sender, byte[] buf, int offset, int length)
      Delivers a message from a given sender to the application
      void receive​(Address sender, java.io.DataInput in)  
      void receiver​(RtReceiver receiver)
      Sets the receiver whose RtReceiver.receive(Object,byte[],int,int) callback will be invoked whenever a message is received
      void send​(java.lang.Object dest, byte[] buf, int offset, int length)
      Sends a message
      void start​(java.lang.String... options)
      Starts the transport, e.g.
      void stop()
      Stops the transport, e.g.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • host

        protected java.net.InetAddress host
      • port

        protected int port
      • server

        protected boolean server
      • nio

        protected boolean nio
      • log

        protected final Log log
    • Constructor Detail

      • ServerTransport

        public ServerTransport()
    • Method Detail

      • options

        public java.lang.String[] options()
        Description copied from interface: RtTransport
        Prints the accepted options, e.g. [-host host] [-port port] [-server host]
        Specified by:
        options in interface RtTransport
        Returns:
      • options

        public void options​(java.lang.String... options)
                     throws java.lang.Exception
        Description copied from interface: RtTransport
        Sets options on this transport. Usually done after creation and before RtTransport.start(String...) is called, but may also be called at runtime.
        Specified by:
        options in interface RtTransport
        Parameters:
        options - The options
        Throws:
        java.lang.Exception
      • localAddress

        public java.lang.Object localAddress()
        Description copied from interface: RtTransport
        Returns the local addres of this member.
        Specified by:
        localAddress in interface RtTransport
        Returns:
        The local address. Implementations without cluster membership may return null
      • clusterMembers

        public java.util.List<java.lang.Object> clusterMembers()
        Description copied from interface: RtTransport
        Returns the addresses of all cluster members. May return null if not implemented
        Specified by:
        clusterMembers in interface RtTransport
        Returns:
        The list of all members in the cluster
      • start

        public void start​(java.lang.String... options)
                   throws java.lang.Exception
        Description copied from interface: RtTransport
        Starts the transport, e.g. connecting to a server socket
        Specified by:
        start in interface RtTransport
        Parameters:
        options - Options passed to the transport at startup time. May be null
        Throws:
        java.lang.Exception
      • stop

        public void stop()
        Description copied from interface: RtTransport
        Stops the transport, e.g. stopping the accept() loop in a TCP-based server
        Specified by:
        stop in interface RtTransport
      • send

        public void send​(java.lang.Object dest,
                         byte[] buf,
                         int offset,
                         int length)
                  throws java.lang.Exception
        Description copied from interface: RtTransport
        Sends a message
        Specified by:
        send in interface RtTransport
        Parameters:
        dest - The destination address
        buf - The buffer
        offset - The offset at which the data starts
        length - The length (in bytes) of the data to send
        Throws:
        java.lang.Exception
      • receive

        public void receive​(Address sender,
                            byte[] buf,
                            int offset,
                            int length)
        Description copied from interface: Receiver
        Delivers a message from a given sender to the application
        Specified by:
        receive in interface Receiver
        Overrides:
        receive in class ReceiverAdapter
        Parameters:
        sender - The sender of the message
        buf - The buffer. An application typically de-serializes data from the buffer into objects used by the application. Note that when receive() returns, it is not safe to use the buffer any longer; if an application needs to use a buffer after this callback returns, it must make a copy.
        offset - The offset at which the received data starts
        length - The length of the received data
      • receive

        public void receive​(Address sender,
                            java.io.DataInput in)
                     throws java.lang.Exception
        Specified by:
        receive in interface Receiver
        Overrides:
        receive in class ReceiverAdapter
        Throws:
        java.lang.Exception