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.
Make the page cache cope well with AsynchronousCloseExceptions

It was possible for a stray interrupt to hit the page cache while in the middle
of a page fault. Such interrupts can cause the victim FileChannel to be closed,
leaving the page cache with a closed StoreChannel without its consent. This can
then cause further complications later on, because PagedFiles are flushed
before they are closed, and so the flushing can throw a ClosedChannelException
and in the end prevent the page cache from being able to shut down.

We now handle this much better, by making sure that the PageSwappers reopen
their StoreChannels whenever one the swapIn or swapOut methods throws a
ClosedChannelException. That is, unless the PageSwapper has been explicitly
closed.
Don't reuse HashMaps for transaction state if they've grown too big

HashMaps that are big use up a lot of memory and take a long time to clear for
reusing.
Merge pull request #3294 from chrisvest/2.2-async-close

[2.2] Make the page cache cope well with AsynchronousCloseExceptions
Merge branch '2.1-maint'
Synchronized shutdown, since the log channel needs external synchronization
Merge pull request #3301 from chrisvest/2.2-recordchanges-close

[2.2] Don't reuse HashMaps for transaction state if they've grown too big
Cheaper way of telling wether or not a RecordState has changes
Defers creation of header information until commit if there are changes
Defers LockGroup creation until we see that there are changes to commit
Reuses tx state --> record state visitor
Reuses command list for extracted commands
Temporarily disable new store tests on windows.
Correctly builds collision information in StringIdMapper

in the rare case of colliding encoded values. If one or more values encode
to the same long value a collision map must be built with their actual
values to be able to correctly find those values later on. Normally, if no
collisions are detected this information can be thrown away and that's
indeed why it's thrown away eagerly in favor of less memory usage.
Makes StringEncoder absolutely garbage free
Removes assumption about platform path delimiter from tests
Implements ArrayCollection that has efficient clear()
Goes to end of line after each csv input entity
Merge pull request #3287 from tinwelint/2.2-lower-tx-init-overhead

[2.2] lower tx init overhead
Rewrite plans with Apply/Optional/Expand to use OptionalExpand instead.