microsoftgraph / microsoftgraph/msgraph-sdk-java

Is GraphServiceClient threadsafe?

未关闭
#2,224 3 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Status: Needs Investigation
主要语言
Java
星标
444
派生
154
平均合并
18 小时 28 分钟
30 天内合并 PR
4

描述

Hi,

I am using msgraph sdk to get 'User' details in an application. Initialized the GraphServiceClient for app-only authentication as specified in the tutorial: https://learn.microsoft.com/en-us/graph/tutorials/java-app-only?tabs=aad&tutorial-step=3.

I want to query the 'users' using certain filter and select criteria, e.g.

_appClient.users().get(requestConfig -> {
        requestConfig.queryParameters.filter = "displayName startsWith \'A\'";
        requestConfig.queryParameters.select = new String[] { "displayName", "id", "mail" };
        requestConfig.queryParameters.top = 25;
        requestConfig.queryParameters.orderby = new String[] { "displayName" };
    });

However, this request may happen from the context of different threads.
My queries are:

  • Does each thread need to instantiate GraphServiceClient separately, or, can we initialize once and share across threads?
  • If _appClient (i.e the instance of GraphServiceClient) can be shared, is it thread-safe or do we need to synchronize access to it?

Any insight will be helpful.

The following artifact versions are used: microsoft-graph (v 6.20.0) and azure-identity (1.14.1).

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从链接的 Microsoft Graph Java app-only 教程以及与 microsoft-graph 6.20.0 和 azure-identity 1.14.1 相关的 GraphServiceClient 用法开始。检查 repository 文档和客户端实现,了解跨线程共享同一个实例的相关指导。完成的标准是明确记录是否支持共享,以及调用方是否需要同步。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
api
Issue 类型
文档
难度
2/5
预计耗时
1-3 小时
活跃度
冷清
描述清晰度
需要澄清
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。