Skip to content

Commit

Permalink
Fix: add bsp dispose method (#1543)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiaaming authored Aug 1, 2024
1 parent 7f2f6d6 commit 2a631cb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
6 changes: 6 additions & 0 deletions extension/src/bs/BspProxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,10 @@ export class BspProxy {
// TODO: Implement more specific error handling logic here
});
}

public closeConnection(): void {
this.buildServerConnector.close();
this.jdtlsImporterConnector.close();
this.logger.info("Build Server connection closed");
}
}
6 changes: 6 additions & 0 deletions extension/src/bs/BuildServerConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ export class BuildServerConnector {
public getServerPipePath(): string {
return this.serverPipePath;
}

public close(): void {
this.serverConnection?.end();
this.serverConnection?.dispose();
this.serverPipeServer.close();
}
}
6 changes: 6 additions & 0 deletions extension/src/bs/JdtlsImporterConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,10 @@ export class JdtlsImporterConnector {
public getImporterConnection(): rpc.MessageConnection | null {
return this.importerConnection;
}

public close(): void {
this.importerConnection?.end();
this.importerConnection?.dispose();
this.importerPipeServer.close();
}
}
2 changes: 2 additions & 0 deletions extension/src/server/GradleServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export class GradleServer {
this._onDidStop.fire(null);
this.ready = false;
this.process?.removeAllListeners();
this.bspProxy.closeConnection();
if (this.restarting) {
this.restarting = false;
await this.start();
Expand Down Expand Up @@ -163,6 +164,7 @@ export class GradleServer {
}

public async asyncDispose(): Promise<void> {
this.bspProxy.closeConnection();
this.process?.removeAllListeners();
await this.killProcess();
this.ready = false;
Expand Down

0 comments on commit 2a631cb

Please sign in to comment.