Skip to content

Unclear in docs if config can be reused and relevant classes are thread safe. #3191

Closed

Description

@timothyTheCoder

E.g.: Can I reuse parts spanding more requests like the response of the getServcie() and have that injected in another class? Are these classes thread safe or should a developer always create a new Translate object?

@Inject
private Translate translate; 
// Somewhere else defined and injected like
// Translate translate = TranslateOptions.newBuilder().setApiKey(googleApiKey).build().getService();
...
public void doTranslation(){
    Translation translation = translate.translate(
                            "Some text here",
                            Translate.TranslateOption.sourceLanguage(sourceLanguage),
                            Translate.TranslateOption.targetLanguage(targetLanguage));
}

Activity

  1. self-assigned this
    on May 8, 2018
  2. added a commit that references this issue on May 11, 2018
    56f451d
  3. added a commit that references this issue on Sep 18, 2018
    d9d7adc
  4. added a commit that references this issue on Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

type: feature request‘Nice-to-have’ improvement, new feature or different behavior or design.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions