Skip to content

Commit 14fcb99

Browse files
U-FAREAST\ramguptU-FAREAST\ramgupt
authored andcommitted
Give the hook to shut down background executor gracefully
1 parent 3ceabf4 commit 14fcb99

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

src/main/java/com/microsoft/graph/concurrency/DefaultExecutors.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,5 +144,8 @@ public void run() {
144144
public ILogger getLogger() {
145145
return logger;
146146
}
147-
147+
148+
public void shutDownBackgroundExecutors() {
149+
this.backgroundExecutor.shutdown();
150+
}
148151
}

src/main/java/com/microsoft/graph/concurrency/IExecutors.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,9 @@ <Result> void performOnForeground(final int progress,
6767
*/
6868
<Result> void performOnForeground(final ClientException exception,
6969
final ICallback<Result> callback);
70+
71+
/**
72+
* Shuts down the background executors
73+
*/
74+
void shutDownBackgroundExecutors();
7075
}

src/main/java/com/microsoft/graph/core/BaseClient.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,4 +173,8 @@ protected void setHttpProvider(final IHttpProvider httpProvider) {
173173
public void setSerializer(final ISerializer serializer) {
174174
this.serializer = serializer;
175175
}
176+
177+
public void shutDown() {
178+
this.executors.shutDownBackgroundExecutors();
179+
}
176180
}

src/main/java/com/microsoft/graph/core/IBaseClient.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,4 +86,9 @@ public interface IBaseClient {
8686
* Validates this client
8787
*/
8888
void validate();
89+
90+
/*
91+
* Shuts down the executors.
92+
*/
93+
void shutDown();
8994
}

0 commit comments

Comments
 (0)