Package net.sf.colossus.webserver
Class ChatMsgStorage
- java.lang.Object
-
- net.sf.colossus.webserver.ChatMsgStorage
-
public class ChatMsgStorage extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private ChatChannelchannelprivate java.util.List<ChatMessage>lastNChatMessagesprivate static java.util.logging.LoggerLOGGERprivate WebServerOptionsoptionsprivate static java.lang.StringSEPJust 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 Summary
Constructors Constructor Description ChatMsgStorage(ChatChannel theChannel, WebServerOptions options)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()ChatChannelgetChannel()java.util.List<ChatMessage>getLastNChatMessages()java.lang.StringmakeLine(ChatMessage msg)private voidparseMsgLine(java.lang.String line)private voidrestoreMessages()(package private) voidstoreMessage(ChatMessage msg)private voidstoreMessages()Store all messages to a permanent storage (Disk file or DB) from where they can be read back when server is restarting
-
-
-
Field Detail
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
options
private final WebServerOptions options
-
channel
private final ChatChannel channel
-
lastNChatMessages
private final java.util.List<ChatMessage> lastNChatMessages
-
SEP
private static final 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".- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ChatMsgStorage
public ChatMsgStorage(ChatChannel theChannel, WebServerOptions options)
-
-
Method Detail
-
dispose
public void dispose()
-
getChannel
public ChatChannel getChannel()
-
getLastNChatMessages
public java.util.List<ChatMessage> getLastNChatMessages()
-
storeMessage
void storeMessage(ChatMessage msg)
-
storeMessages
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
-
restoreMessages
private void restoreMessages()
-
makeLine
public java.lang.String makeLine(ChatMessage msg)
-
parseMsgLine
private void parseMsgLine(java.lang.String line)
-
-