class AddSynonymsToCache extends Thread {
    private String word;
    private Locale locale;

    private AddSynonymsToCache(String word, Locale locale) {
      this.word = word;
      this.locale = locale;
    }
    
    @Override
    public void run() {<FILL_FUNCTION_BODY>}

  }

      List<String> synonyms = new ArrayList<>();
      try {
        XThesaurus thesaurus = getThesaurus(xContext);
        if (thesaurus == null) {
          MessageHandler.printToLogFile("LinguisticServices: getSynonyms: XThesaurus == null");
          return;
        }
        if (locale == null) {
          MessageHandler.printToLogFile("LinguisticServices: getSynonyms: Locale == null");
          return;
        }
        PropertyValue[] properties = new PropertyValue[0];
        XMeaning[] meanings = thesaurus.queryMeanings(word, locale, properties);
        for (XMeaning meaning : meanings) {
          if (synonyms.size() >= OfficeTools.MAX_SUGGESTIONS) {
            break;
          }
          String[] singleSynonyms = meaning.querySynonyms();
          Collections.addAll(synonyms, singleSynonyms);
        }
        synonymsCache.put(word, synonyms);
      } catch (Throwable t) {
        // If anything goes wrong, give the user a stack trace
        MessageHandler.printException(t);
      }
    
<methods>public non-sealed void <init>() ,public int getNumberOfSyllables(java.lang.String, org.languagetool.Language) ,public List<java.lang.String> getSynonyms(java.lang.String, org.languagetool.Language) ,public boolean isCorrectSpell(java.lang.String, org.languagetool.Language) ,public void setThesaurusRelevantRule(org.languagetool.rules.Rule) <variables>