Class ShortMessageService

  • All Implemented Interfaces:
    IShortMessageService

    public class ShortMessageService
    extends java.lang.Object
    implements IShortMessageService
    Service that sends messages to followers. - Follower is online: directly call a client message - Follower is offline: add to his postbox
    • Field Detail

      • postboxes

        protected java.util.Map<User,​java.util.Collection<ShortMessage>> postboxes
        The post boxes of the users.
    • Constructor Detail

      • ShortMessageService

        public ShortMessageService()
    • Method Detail

      • init

        public void init()
        Init of service
      • sendMessage

        public IFuture<java.lang.Void> sendMessage​(java.lang.String text,
                                                   java.lang.String usertoken)
        Send a message to the followers.
        Specified by:
        sendMessage in interface IShortMessageService
        Parameters:
        text - The text.
        sender - The sender.
      • getMessages

        public IFuture<java.util.Collection<ShortMessage>> getMessages​(java.lang.String usertoken)
        Get all messages.
        Specified by:
        getMessages in interface IShortMessageService
        Parameters:
        usertoken - The user token.
        Returns:
        the messages.
      • addMessageToPostbox

        protected void addMessageToPostbox​(User user,
                                           ShortMessage message)
        Add a message to a postbox of a user.
        Parameters:
        user - The user.
        message - The message.