void Events_OnNewProcess(object sender, NewProcessEventArgs args) { Process incriminatedProcess = args.TheProcess; // The process can be null in case of short life cycle if (incriminatedProcess == null) { return; } try { if (this.rootProcess.Id != incriminatedProcess.Id) { // Log info about the incriminated process LOGGER.Info("A new process " + incriminatedProcess.ProcessName + " [pid:" + incriminatedProcess.Id + "] has been detected"); // The parunas tool will spawn the java process (ProActive Runtime) if (this.paRuntimeJavaProcess == null && "java".Equals(incriminatedProcess.ProcessName)) { this.paRuntimeJavaProcess = incriminatedProcess; } } // Fix for AGENT-223: Don't add processes to CPULimiter if the planning is set as Always available and the Max CPU usage is 100% if (this.commonStartInfo.isCpuLimiterEnabled) { if (this.cpuLimiter.addProcessToWatchList(incriminatedProcess)) { LOGGER.Info("Added new process " + incriminatedProcess.ProcessName + " [pid:" + incriminatedProcess.Id + "] to the cpu limiter"); } } } catch (Exception ex) { LOGGER.Info("An error occured in Events_OnNewProcess incrminatedProcess: " + incriminatedProcess, ex); } }
private void NewProcessEventHandler(object sender, NewProcessEventArgs e) { AppOpenedEvent?.Invoke(this, new AppOpenedEventArgs(e.ProcessType)); }