UNPKG

rhamt-vscode-extension

Version:

RHAMT VSCode extension

30 lines (25 loc) 777 B
import { RaasClient } from 'raas-client'; export class RuntimeService { private runtimes: Map<string, RaasClient> = new Map<string, RaasClient>(); getRaasClient(host: string, port: number): RaasClient { const id = `${host}:${port}`; let runtime = this.runtimes.get(id); if (!runtime) { const newRuntime = runtime = new RaasClient(); this.runtimes.set(id, newRuntime); } return runtime; } shutdownServers(): void { this.runtimes.forEach(client => { client.shutdownServer(); }); this.runtimes.clear(); } disconnect(): void { this.runtimes.forEach(client => { client.disconnect(); }); this.runtimes.clear(); } }