Added support for batched writes in the JSR 356 implementation.
Implemented flush() using async callbacks, since it may perform 2
writes (the queue and the replies), and they must be done one after
the other.