/// <summary> /// Checks if one callback is active /// </summary> /// <param name="paramCallbackToCheck">Callback to check</param> /// <returns></returns> private async Task <bool> sentAsyncSignalToCallback(IServicioCallback paramCallbackToCheck) { try { // Checks if the callback is null if (paramCallbackToCheck != null) { // Checks on async method with timeout if the operator is alive bool isActive = await(Task.Run <bool>(() => { try { return(paramCallbackToCheck.IsActive()); } catch (Exception ex) { Log.Error(_operatorClassName, "details: " + ex.Message); return(false); } })).TimeoutAfter(_dblOperatorTimeoutAwaitResponse); return(isActive); } } catch (TimeoutException) { return(false); } catch (Exception ex) { Log.Error(_operatorClassName, "error awaiting response: " + ex.Message); return(false); } throw new Exception("callback is null."); }
/// <summary> /// Checks if the callback of the client related is active /// </summary> /// <returns>true if is active, false</returns> private async Task <bool> isCallbackActive(IServicioCallback paramCallbackToCheck) { try { return(await Task.Run(() => { return paramCallbackToCheck.IsActive(); })); } catch (Exception ex) { throw ex; } }