I am writing a desktop app using SWT which receive log data from network at high speed rate (nearly 100 packet per second). Each packet contains a line which must be appended to a StyledText
. Since I receive packets in non-UI thread, I have to use this code:
display.asyncExec(new Runnable() {
@Override
public void run() {
txtLog.append(log);
txtLog.setTopIndex(txtLog.getLineCount() - 1);
}
});
But this code makes my Logger too slow, and the output of my logger is not synchronized with sender. For example I stop sender device and my program log output stops after 3 minutes!!, However, the eclipse console output( System.out.println()
) is completely sync with sender and stop outputs on time! How does eclipse setText()
its StyledText
?