please, change order of code

// get agent names
 Set<PlotNode> plotNodeList = new HashSet<PlotNode>();
...
Map<String,Set<String>> agentNames = getAgentNamesForMonitoringParameters(plotNodeList);

// get session scope node
Set<PlotNode> ssPlotNodes = new HashSet<PlotNode>();
...
ssPlotNodes.addAll(getSessionScopeNodes(monitoringMap));
}

and 

if (sessionIds.size() == 1 && ssPlotNodes.size() > 0) {
...
 sessionScopeNode = null;
}

// get tree
...