public void start() { if ( pamProxy == null) { startOnSetPAMProxy = true; return; } if ( descriptorChangeMonitorInterval > 0 ) { try { monitor = new DescriptorChangeMonitor(Thread.currentThread().getThreadGroup(), "PortletApplicationManager Descriptor Change Monitor Thread", pamProxy, descriptorChangeMonitorInterval, maxRetriedStarts); monitor.setContextClassLoader(getClass().getClassLoader()); monitor.start(); log.info("PortletApplicationManager Descriptor Change Monitor started!"); } catch (Exception e) { log.warn("Unable to start PortletApplicationManager Descriptor Change Monitor: "+ e.toString(), e); monitor.safeStop(); monitor = null; } } started = true; }
public synchronized void run() { try { wait(interval); } catch (InterruptedException e) { } while (started) { checkDescriptorChanges(); try { wait(interval); } catch (InterruptedException e) { } } }
/** * notifies a switch variable that exits the watcher's montior loop started in the <code>run()</code> method. */ public void safeStop() { // stop this monitor thread synchronized (this) { started = false; monitorInfos.clear(); notifyAll(); } // wait for monitor thread stop try { join(interval); } catch (InterruptedException ie) { } }
if (changeMonitor != null) monitored = changeMonitor.isMonitored(contextName); changeMonitor.remove(contextName); changeMonitor.monitor(contextName, contextPath, paClassLoader, paType, warStruct.getRootDirectory(), checksum); changeMonitor.monitor(contextName, contextPath, paClassLoader, paType, warStruct.getRootDirectory(), checksum); changeMonitor.get(contextName).setUnsuccessfulStarts(1);
if ( monitor != null ) monitor.remove(contextName);
public boolean isMonitored(String contextName) { DescriptorChangeMonitorInfo monitorInfo = this.get(contextName); if (monitorInfo != null && !monitorInfo.isObsolete()) { return true; } return false; }
public void stop() { started = false; if (monitor != null) { monitor.safeStop(); monitor = null; } }
public DescriptorChangeMonitor(ThreadGroup group, String name, PortletApplicationManagement pam, long interval, int maxretriedStarts) { super(group, name); this.pam = pam; this.interval = interval; monitorInfos = new ArrayList(); setPriority(MIN_PRIORITY); setDaemon(true); this.maxRetriedStarts = maxretriedStarts; }