Class PubClient

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected BaseServer client  
      protected java.io.InputStream in  
      protected java.lang.String name  
      protected boolean running  
    • Constructor Summary

      Constructors 
      Constructor Description
      PubClient​(java.lang.String name)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void connectionClosed​(Connection conn)  
      void connectionEstablished​(Connection conn)  
      protected void eventLoop()  
      protected static void help()  
      static void main​(java.lang.String[] args)  
      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 receive​(Address sender, java.nio.ByteBuffer buf)
      The default implementation assumes that ByteBuffer.flip() or ByteBuffer.rewind() was called on buf before invoking this callback
      protected void send​(java.lang.String str)  
      protected void start​(java.net.InetAddress srv_addr, int srv_port, boolean nio)  
      • Methods inherited from class java.lang.Object

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

      • name

        protected final java.lang.String name
      • running

        protected volatile boolean running
      • in

        protected java.io.InputStream in
    • Constructor Detail

      • PubClient

        public PubClient​(java.lang.String name)
    • Method Detail

      • receive

        public void receive​(Address sender,
                            java.nio.ByteBuffer buf)
        Description copied from class: ReceiverAdapter
        The default implementation assumes that ByteBuffer.flip() or ByteBuffer.rewind() was called on buf before invoking this callback
        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.

        Note that buf could be a direct ByteBuffer.

      • 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
      • start

        protected void start​(java.net.InetAddress srv_addr,
                             int srv_port,
                             boolean nio)
                      throws java.lang.Exception
        Throws:
        java.lang.Exception
      • eventLoop

        protected void eventLoop()
      • send

        protected void send​(java.lang.String str)
                     throws java.lang.Exception
        Throws:
        java.lang.Exception
      • main

        public static void main​(java.lang.String[] args)
                         throws java.lang.Exception
        Throws:
        java.lang.Exception
      • help

        protected static void help()