/** An instance bound to a bundle. This method uses the specified class * loader to find the bundle. Note, the specified class loader must not * be <code>null</code>. * @param bundleName the name of the bundle * @param loader the class loader from which to load the resource * bundle * @return the helper instance bound to the bundle */ public static I18NHelper getInstance (String bundleName, ClassLoader loader) { I18NHelper helper = (I18NHelper) helpers.get (bundleName); if (helper != null) { return helper; } helper = new I18NHelper(bundleName, loader); helpers.put (bundleName, helper); // if two threads simultaneously create the same helper, return the first // one to be put into the Hashtable. The other will be garbage collected. return (I18NHelper) helpers.get (bundleName); }
/** An instance bound to a bundle. This method uses the specified class * loader to find the bundle. Note, the specified class loader must not * be <code>null</code>. * @param bundleName the name of the bundle * @param loader the class loader from which to load the resource * bundle * @return the helper instance bound to the bundle */ public static I18NHelper getInstance (String bundleName, ClassLoader loader) { I18NHelper helper = (I18NHelper) helpers.get (bundleName); if (helper != null) { return helper; } helper = new I18NHelper(bundleName, loader); helpers.put (bundleName, helper); // if two threads simultaneously create the same helper, return the first // one to be put into the Hashtable. The other will be garbage collected. return (I18NHelper) helpers.get (bundleName); }