code: public static Messages getInstance(Locale locale, Class<?> cls)
    {
      Messages instance = null;
      locale = (locale == null) ? Locale.getDefault() : locale;
      
      String bundleKey = (cls==null)? BUNDLE_NAME : getBundleName(cls);   
      String localeKey = locale.getLanguage();
      if (messageTable.contains(bundleKey, localeKey)) {
        instance = messageTable.get(bundleKey, localeKey);
      } 
      else 
      {
        synchronized (Messages.class) 
        {
          if (instance == null) 
          {
            instance = new Messages(locale, bundleKey);
            messageTable.put(bundleKey, localeKey, instance);
          }
        }
      }
      
      return instance;
   
    }
docs: Get a Messages instance that has been localized for the given locale, or
  the default locale if locale is null. Note that passing an unknown locale
  returns the default messages.
  
  @param locale
  The locale to use for localization of the messages.
  @return The localized messages or default.