public synchronized void monitor(String contextName, String contextPath, ClassLoader paClassLoader, int paType, File paDir, long checksum) { monitorInfos.add(new DescriptorChangeMonitorInfo(contextName, contextPath, paClassLoader, paType, paDir, checksum)); }
public synchronized void remove(String contextName) { DescriptorChangeMonitorInfo monitorInfo; for ( int i = monitorInfos.size()-1; i > -1; i-- ) { monitorInfo = (DescriptorChangeMonitorInfo)monitorInfos.get(i); if (contextName.equals(monitorInfo.getContextName())) { // will be removed by checkDescriptorChanges on next iteration monitorInfo.setObsolete(); break; } } }
if (monitorInfo.isObsolete()) int unsuccessfulStarts = monitorInfo.getUnsuccessfulStarts(); if (monitorInfo.isChanged() || (unsuccessfulStarts > 0 && unsuccessfulStarts <= maxRetriedStarts)) pam.tryStartPortletApplication(monitorInfo.getContextName(), monitorInfo.getContextPath(), new DirectoryHelper(monitorInfo.getPADir()), monitorInfo.getPAClassLoader(), monitorInfo.getPortletApplicationType(), monitorInfo.getChecksum(), true); monitorInfo.setUnsuccessfulStarts(0); if (monitorInfo.isChanged()) log.error("Failed to restart PortletApplication "+monitorInfo.getContextName(),e); log.warn("Failed to restart PortletApplication "+monitorInfo.getContextName(),e); monitorInfo.setUnsuccessfulStarts(unsuccessfulStarts + 1); if (log.isDebugEnabled()) log.debug("Number of unsuccessful PA starts is " + monitorInfo.getUnsuccessfulStarts() + "."); if (monitorInfo.getUnsuccessfulStarts() > maxRetriedStarts) log.error("Max number of retries (" + maxRetriedStarts +") reached. Ignoring Monitor for " + monitorInfo.getContextName()); log.error("Descriptor Change check failure for PortletApplication "+monitorInfo.getContextName(),e);
public synchronized DescriptorChangeMonitorInfo get(String contextName) { DescriptorChangeMonitorInfo monitorInfo; for ( int i = monitorInfos.size()-1; i > -1; i-- ) { monitorInfo = (DescriptorChangeMonitorInfo)monitorInfos.get(i); if (contextName.equals(monitorInfo.getContextName())) { return monitorInfo; } } return null; }
public boolean isMonitored(String contextName) { DescriptorChangeMonitorInfo monitorInfo = this.get(contextName); if (monitorInfo != null && !monitorInfo.isObsolete()) { return true; } return false; }