Class ChatSpeaker

java.lang.Object
edu.pdx.cs410J.net.ChatSpeaker
All Implemented Interfaces:
Runnable

public class ChatSpeaker extends Object implements Runnable
A ChatSpeaker runs in the background and sends ChatMessages over a Socket.
  • Constructor Details

    • ChatSpeaker

      public ChatSpeaker()
      Creates a new ChatSpeaker
  • Method Details

    • setSocket

      public void setSocket(Socket socket)
      Sets the socket to which this ChatSpeaker sends messages.
    • run

      public void run()
      A ChatSpeaker uses wait/notify on its incoming list to know when to send a message. For the sake of symmetry, we interrupt it to tell it to stop.
      Specified by:
      run in interface Runnable
    • sendMessage

      public void sendMessage(ChatMessage message)
      Queues a message to be sent. This method will be called by a thread other than the one running run().