Package edu.pdx.cs410J.net
Class ChatSpeaker
java.lang.Object
edu.pdx.cs410J.net.ChatSpeaker
- All Implemented Interfaces:
Runnable
A
ChatSpeaker
runs in the background and sends
ChatMessage
s over a Socket
.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
run()
AChatSpeaker
uses wait/notify on itsincoming
list to know when to send a message.void
sendMessage
(ChatMessage message) Queues a message to be sent.void
Sets the socket to which thisChatSpeaker
sends messages.
-
Constructor Details
-
ChatSpeaker
public ChatSpeaker()Creates a newChatSpeaker
-
-
Method Details
-
setSocket
Sets the socket to which thisChatSpeaker
sends messages. -
run
AChatSpeaker
uses wait/notify on itsincoming
list to know when to send a message. For the sake of symmetry, we interrupt it to tell it to stop. -
sendMessage
Queues a message to be sent. This method will be called by a thread other than the one running run().
-