update DynamicFactory to be thread safe - when a constructor for given parameters is not found a lock is obtained before searching for an appropriate match.

Change-Id: I5d43e9263cb37cf985f6426fa892dd3e31e74529
Signed-off-by: Egon Willighagen <egonw@users.sourceforge.net>