BUG-2459: do not instantiate factories in fastpath

This caches the factories in static fields rather than instantiating
them on each call.

Change-Id: I4dfee7724320914f2c7c9724192e4653deea3cde
Signed-off-by: Robert Varga <rovarga@cisco.com>