How to prevent multiple object instantiations of a certain class
<pre><code>MyInterface intf = (MyInterface) Class.forName(className).newInstance();
</code></pre>

<p>I have a certain piece of code which will create new interfaces on demand using the above call and invoke a certain method. All of the implementation classes usually contain lots of <code>final static</code> variables and static initialization code which I would like to fire only once in its lifetime.</p>

<p>But since I am using the newInstance() call, I am under the impression that the old object gets GCed and the class is initialized again and hence all the static variables.</p>

<p>In order to avoid this, I would like to put this in a cache, so that these classes are not re-constructed again and hence would be initialized once during its lifetime. (Note: My interfaces are thread-safe).</p>

<p>Should I just put this in a <code>Hashtable</code> and just look it up or is there a better way to handle the cache?</p>
