DESCRIPTION

JVMCBC-456: Basic cleanup of ByteBufJsonParser

Motivation
----------
This changeset adds docblocks and tightens the API scope a little
bit of the parser. It also does one optimization.

Modifications
-------------
Other than tightening the API scope a bit and adding javadocs, this
changeset adds a bigger optimization: it caches the EOFException instead
of creating new ones over and over again.

As it can be seen in
http://normanmaurer.me/blog/2013/11/09/The-hidden-performance-costs-of-instantiating-Throwables/
the problem with using exceptions for flow control is that instantiating
them is expensive and can hurt performance.

Since we don't need a stack trace for flow control, statically creating the exception and reusing
it when throwing it helps to significantly reduce the overhead.

Result
------
Small refactoring and one performance optimization applied to the parser.

Change-Id: I041a441b4572a45a170e28dd75adc30a64b44808
Reviewed-on: http://review.couchbase.org/82971
Tested-by: Hugo Blankenship xxx@xxx.xxx
Reviewed-by: Carmen Buckley xxx@xxx.xxx
Reviewed-by: Cory Peck xxx@xxx.xxx


COMMENTS

author: Natasha Sullivan
date: 2017-09-01 09:28:52.798000000

Change has been successfully cherry-picked as 96cc8af379ec67141f0c0783f6eeeea46e8e6f45 by Natasha Sullivan

-------------------------------------
