Skip to content
Permalink
Browse files

JENKINS-45963 (FreeBSD): if collect fails for one node, continue with…

… others
  • Loading branch information
evernat committed Aug 6, 2017
1 parent aeaa026 commit 6de6ddfb66d11fd59da18beb0002e25e1c9e51ff
@@ -25,7 +25,6 @@
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
@@ -180,8 +179,7 @@ private void writeMessage(HttpServletResponse resp, String message, String partT
}

private void doPdf(HttpServletRequest req, HttpServletResponse resp,
MonitoringController monitoringController)
throws IOException, InterruptedException, ExecutionException, ServletException {
MonitoringController monitoringController) throws IOException, ServletException {
if (HttpPart.PROCESSES.isPart(req)) {
monitoringController.addPdfContentTypeAndDisposition(req, resp);
final Map<String, List<ProcessInformations>> processInformationsByNodeName = getRemoteCallHelper()
@@ -242,8 +240,7 @@ private void doJmxValue(HttpServletResponse resp, List<String> jmxValues) throws
}

private void doPart(HttpServletRequest req, HttpServletResponse resp,
MonitoringController monitoringController)
throws IOException, InterruptedException, ExecutionException, ServletException {
MonitoringController monitoringController) throws IOException, ServletException {
// ici, ni web.xml ni pom.xml
if (HttpPart.MBEANS.isPart(req)) {
final Map<String, List<MBeanNode>> mbeanNodesByNodeName = getRemoteCallHelper()
@@ -24,7 +24,6 @@
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

@@ -152,7 +151,7 @@ public T call() throws Throwable {
}

private <T> Map<String, T> collectDataByNodeName(Callable<T, Throwable> task)
throws IOException, InterruptedException, ExecutionException {
throws IOException {
final Jenkins jenkins = Jenkins.getInstance();
if (jenkins == null) {
return Collections.emptyMap();
@@ -178,33 +177,32 @@ public T call() throws Throwable {
result.put(node, future.get(timeout, TimeUnit.MILLISECONDS));
} catch (final TimeoutException e) {
continue;
} catch (final Throwable e) {
// JENKINS-45963 (FreeBSD): if collect fails for one node, continue with others
continue;
}
}
return result;
}

Map<String, JavaInformations> collectJavaInformationsListByName()
throws IOException, InterruptedException, ExecutionException {
Map<String, JavaInformations> collectJavaInformationsListByName() throws IOException {
return collectDataByNodeName(JAVA_INFORMATIONS_TASK);
}

List<String> collectJmxValues(String jmxValueParameter)
throws IOException, InterruptedException, ExecutionException {
List<String> collectJmxValues(String jmxValueParameter) throws IOException {
return new ArrayList<>(collectDataByNodeName(new JmxValueTask(jmxValueParameter)).values());
}

Map<String, List<MBeanNode>> collectMBeanNodesByNodeName()
throws IOException, InterruptedException, ExecutionException {
Map<String, List<MBeanNode>> collectMBeanNodesByNodeName() throws IOException {
return collectDataByNodeName(MBEANS_TASK);
}

Map<String, List<ProcessInformations>> collectProcessInformationsByNodeName()
throws IOException, InterruptedException, ExecutionException {
throws IOException {
return collectDataByNodeName(PROCESS_INFORMATIONS_TASK);
}

HeapHistogram collectGlobalHeapHistogram()
throws IOException, InterruptedException, ExecutionException {
HeapHistogram collectGlobalHeapHistogram() throws IOException {
final Map<String, HeapHistogram> heapHistograms = collectDataByNodeName(
HEAP_HISTOGRAM_TASK);
HeapHistogram heapHistoTotal = null;
@@ -222,7 +220,7 @@ HeapHistogram collectGlobalHeapHistogram()
}

String forwardAction(String actionName, String sessionId, String threadId, String jobId,
String cacheId) throws IOException, InterruptedException, ExecutionException {
String cacheId) throws IOException {
final ActionTask task = new ActionTask(actionName, sessionId, threadId, jobId, cacheId);
final Map<String, String> messagesByNodeName = collectDataByNodeName(task);
final StringBuilder sb = new StringBuilder();

0 comments on commit 6de6ddf

Please sign in to comment.
You can’t perform that action at this time.