Why the need for synchronization here? Is it possible to do something like make the template types static?