Class MessageSender

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  MessageSender.AsynchSender
      MessageSender implementation which uses the Asynchronous Call/Response pattern.
      private static class  MessageSender.BlockingMap
      Map implementation which dispenses its contents via an iterator which will block until all the results are in.
      private static class  MessageSender.BlockingSet
      Set implementation which dispenses its contents via an iterator which will block until all results are in.
      private static class  MessageSender.MetaClient
      Client implementation which may know about metadata.
      private static class  MessageSender.NotifySender
      MessageSender implementation which uses the Notify pattern.
      private static class  MessageSender.SynchSender
      MessageSender implementation which uses the Synchronous Call/Response pattern.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static java.util.logging.Logger logger_  
    • Constructor Summary

      Constructors 
      Constructor Description
      MessageSender()  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) abstract java.util.Map getResponses​(HubConnection connection, Message msg, java.lang.String[] recipientIds)
      Sends a message to a given list of recipients.
      static void main​(java.lang.String[] args)
      Main method.
      private static java.lang.String[] namesToIds​(HubConnection conn, java.lang.String[] names)
      Translates an array of client names to client IDs.
      static int runMain​(java.lang.String[] args)
      Does the work for the main method.
      (package private) void showResults​(HubConnection connection, Message msg, java.lang.String[] recipientIds, java.io.PrintStream out)
      Sends a message to a list of recipients and displays the results on an output stream.
      • Methods inherited from class java.lang.Object

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

      • logger_

        private static java.util.logging.Logger logger_
    • Constructor Detail

      • MessageSender

        public MessageSender()
    • Method Detail

      • getResponses

        abstract java.util.Map getResponses​(HubConnection connection,
                                            Message msg,
                                            java.lang.String[] recipientIds)
                                     throws java.io.IOException
        Sends a message to a given list of recipients. If recipientIds is null, then will be sent to all subscribed clients.
        Parameters:
        connection - hub connection
        msg - message to send
        recipientIds - array of recipients to target, or null
        Returns:
        responder Client -> Response map
        Throws:
        java.io.IOException
      • showResults

        void showResults​(HubConnection connection,
                         Message msg,
                         java.lang.String[] recipientIds,
                         java.io.PrintStream out)
                  throws java.io.IOException
        Sends a message to a list of recipients and displays the results on an output stream.
        Parameters:
        connection - hub connection
        msg - message to send
        recipientIds - array of recipients to target, or null
        destination - print stream
        Throws:
        java.io.IOException
      • namesToIds

        private static java.lang.String[] namesToIds​(HubConnection conn,
                                                     java.lang.String[] names)
                                              throws SampException
        Translates an array of client names to client IDs. If some or all cannot be identified, an exception is thrown.
        Parameters:
        conn - hub connection
        names - array of client names, interpreted case-insensitively
        Returns:
        array of client ids corresponding to names
        Throws:
        SampException
      • main

        public static void main​(java.lang.String[] args)
                         throws java.io.IOException
        Main method. Use -help flag for documentation.
        Throws:
        java.io.IOException
      • runMain

        public static int runMain​(java.lang.String[] args)
                           throws java.io.IOException
        Does the work for the main method.
        Throws:
        java.io.IOException