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>
(cherry picked from commit a69a67c76a04a89d870e9f12df7919cbeb0d5001)
Merge "BUG-2459: do not instantiate factories in fastpath" into stable/helium