public class ChatMsgStorage
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private ChatChannel |
channel |
private java.util.List<ChatMessage> |
lastNChatMessages |
private static java.util.logging.Logger |
LOGGER |
private WebServerOptions |
options |
private static java.lang.String |
SEP
Just by coincidence, we use the same separator as for the network
transmissions, so then there is no risk of "can't be unambiguely
encoded".
|
Constructor and Description |
---|
ChatMsgStorage(ChatChannel theChannel,
WebServerOptions options) |
Modifier and Type | Method and Description |
---|---|
void |
dispose() |
ChatChannel |
getChannel() |
java.util.List<ChatMessage> |
getLastNChatMessages() |
java.lang.String |
makeLine(ChatMessage msg) |
private void |
parseMsgLine(java.lang.String line) |
private void |
restoreMessages() |
(package private) void |
storeMessage(ChatMessage msg) |
private void |
storeMessages()
Store all messages to a permanent storage (Disk file or DB) from where
they can be read back when server is restarting
|
private static final java.util.logging.Logger LOGGER
private final WebServerOptions options
private final ChatChannel channel
private final java.util.List<ChatMessage> lastNChatMessages
private static final java.lang.String SEP
public ChatMsgStorage(ChatChannel theChannel, WebServerOptions options)
public void dispose()
public ChatChannel getChannel()
public java.util.List<ChatMessage> getLastNChatMessages()
void storeMessage(ChatMessage msg)
private void storeMessages()
private void restoreMessages()
public java.lang.String makeLine(ChatMessage msg)
private void parseMsgLine(java.lang.String line)