Enabling Buffered Writes in Java OJAI

By default, MapR Database JSON does not buffer writes. You can improve performance by enabling buffered writes in your Java OJAI application.


The buffered writes option can be set in the Connection.getStore method. You pass the option setting through a Document object in the second parameter to the method. The Document object sets ojai.mapr.documentstore.buffer-writes to either true or false. The default value is false, which means that writes are not buffered.

Example Code Snippet

The following code sample enables buffered writes:

final DocumentStore store =
        connection.newDocument().set("ojai.mapr.documentstore.buffer-writes", true));