long currentTime = System.currentTimeMillis();
if (containerWrapper == null) {
logger.error("Cannot collect application stats. Container wrapper is not set.");
} else {
TomcatContainer tomcatContainer = getContainerWrapper().getTomcatContainer();
// check if the containerWtapper has been initialized
if (tomcatContainer != null) {
long totalReqDelta = 0;
long totalAvgProcTime = 0;
int participatingAppCount = 0;
List contexts = tomcatContainer.findContexts();
for (Iterator i = contexts.iterator(); i.hasNext(); ) {
Context ctx = (Context) i.next();
if (ctx != null && ctx.getName() != null) {
Application app = new Application();