in common/lib/plugins/efm2/host_monitoring2_connection_plugin.ts [85:122]
async execute<T>(methodName: string, methodFunc: () => Promise<T>, methodArgs: any): Promise<T> {
const isEnabled: boolean = WrapperProperties.FAILURE_DETECTION_ENABLED.get(this.properties);
if (!isEnabled || !SubscribedMethodHelper.NETWORK_BOUND_METHODS.includes(methodName)) {
return methodFunc();
}
const failureDetectionTimeMillis: number = WrapperProperties.FAILURE_DETECTION_TIME_MS.get(this.properties);
const failureDetectionIntervalMillis: number = WrapperProperties.FAILURE_DETECTION_INTERVAL_MS.get(this.properties);
const failureDetectionCount: number = WrapperProperties.FAILURE_DETECTION_COUNT.get(this.properties);
let result: T;
let monitorContext: MonitorConnectionContext | null = null;
try {
logger.debug(Messages.get("HostMonitoringConnectionPlugin.activatedMonitoring", methodName));
const monitoringHostInfo: HostInfo = await this.getMonitoringHostInfo();
monitorContext = await this.monitorService.startMonitoring(
this.pluginService.getCurrentClient().targetClient,
monitoringHostInfo,
this.properties,
failureDetectionTimeMillis,
failureDetectionIntervalMillis,
failureDetectionCount
);
result = await methodFunc();
} finally {
if (monitorContext != null) {
await this.monitorService.stopMonitoring(monitorContext, this.pluginService.getCurrentClient().targetClient);
logger.debug(Messages.get("HostMonitoringConnectionPlugin.monitoringDeactivated", methodName));
}
}
return result;
}