try {
response.setContentType(CONTENT_TYPE);
response.setHeader("pragma", "no-cache");
Integer methodId = new Integer(request.getParameter("methodId"));
JBPMethod keyMethod = new JBPMethod();
keyMethod.setMethodID(methodId.intValue());
javax.servlet.http.HttpSession session = request.getSession();
org.jboss.profiler.web.form.FilterForm beanFilter = (org.jboss.profiler.web.form.FilterForm) request
.getSession().getAttribute("filterForm");
org.jboss.profiler.model.JBPProcess spyProcess = beanFilter
.getJbpProcess();
Integer threadId = null;
JBPThread thread = null;
if (request.getParameter("threadId") != null) {
JBPThread threadKey = new JBPThread();
threadId = new Integer(request.getParameter("threadId"));
threadKey.setThreadId(threadId.intValue());
thread = (JBPThread) spyProcess.getSpyThreads().get(threadKey);
}
HashMap spyMethods = spyProcess.getSpyMethods();
JBPMethod spyMethodProcess = (JBPMethod) spyMethods.get(keyMethod);
JBPMethodCount consolidacao = (JBPMethodCount) request.getSession()
.getAttribute("consolidacaoMetodo");
if (thread == null
&& (consolidacao == null
|| consolidacao.getSpyMethod().equals(
spyMethodProcess) || session
.getAttribute("consolidacaoThread") != null)) {
consolidacao = spyProcess.consolidaCallings(spyMethodProcess);
session.setAttribute("consolidacaoMetodo", consolidacao);
session.removeAttribute("consolidacaoThread");
} else {
JBPThread consolidacaoThread = (JBPThread) session
.getAttribute("consolidacaoThread");
if (thread != null
&& (consolidacao == null
|| consolidacaoThread == null
|| consolidacaoThread.getThreadId() != threadId
.intValue() || !consolidacao
.getSpyMethod().equals(spyMethodProcess))) {
consolidacao = thread.consolidaCallings(spyMethodProcess);
session.setAttribute("consolidacaoMetodo", consolidacao);
session.setAttribute("consolidacaoThread", thread);
}
}
// qual instancia sera utilizada no calculo
JBPMethod spyMethodToCalc = spyMethodProcess;
if (thread != null) {
spyMethodToCalc = (JBPMethod) thread.getSpyMethods().get(
spyMethodToCalc);
}
int numberOfPaths = 0;
if (request.getParameter("npath") != null) {
numberOfPaths = Integer.parseInt(request.getParameter("npath"));
}
int methodsId[] = new int[numberOfPaths];
JBPMethod metodosPesquisados[] = new JBPMethod[numberOfPaths];
String urlBasesrc = "methodId=" + methodId; // url para seguir o
// caminho
if (thread != null) {
urlBasesrc += "&threadId=" + threadId;