writeString(String str): synchronize using socket write lock to prevent split SAM messages

This commit is contained in:
BlubMail
2009-09-06 00:43:45 +00:00
parent 1f1d089fda
commit 2341793546

View File

@ -124,9 +124,13 @@ public abstract class SAMHandler implements Runnable {
* @return True if the string was successfully written, false otherwise
*/
protected final boolean writeString(String str) {
boolean success;
if (_log.shouldLog(Log.DEBUG))
_log.debug("Sending the client: [" + str + "]");
return writeString(str, socket);
synchronized (socketWLock) {
success = writeString(str, socket);
}
return success;
}
public static boolean writeString(String str, SocketChannel out)