Batch writer thread empties buffer into channel

instead of each append call, which allows for less calls to
FileChannel#write and less I/O wait for append threads.
Synchronized shutdown, since the log channel needs external synchronization
Merge pull request #3283 from tinwelint/2.2-empty-log-buffer-in-force-thread

[2.2] Batch writer thread empties buffer into channel