scifio/scifio — pull request #21 by dscho (2013-08-15 16:31:34+00:00)
Title: Initialize the format service lazily, i.e. only when needed

Similar to what I suggested in http://trac.imagej.net/ticket/1980#comment:2,
this pull request makes the initialization lazy, i.e. on-demand.

To keep things relatively quick by default, we *avoid* synchronized blocks,
checking first whether we need to initialize the maps in an non-synchronized
fashion before handing off to the synchronized ```initializeMaps``` function
that checks again just to be sure.

It will be the common case, i.e. once initialized, that we never hit the
synchronized method, but before that, we will be safe and synchronized.

Signed-off-by: Johannes Schindelin