Search in sources :

Example 1 with ServerLoadMonitor

use of org.directwebremoting.extend.ServerLoadMonitor in project ma-core-public by infiniteautomation.

the class DwrServlet method shutdown.

/**
 * Kill all comet polls.
 * <p>Technically a servlet engine ought to call this only when all the
 * threads are already removed, however at least Tomcat doesn't do this
 * properly (it waits for a while and then calls destroy anyway).
 * <p>It would be good if we could get {@link #destroy()} to call this
 * method however destroy() is only called once all threads are done so it's
 * too late.
 */
public void shutdown() {
    ServerLoadMonitor monitor = (ServerLoadMonitor) container.getBean(ServerLoadMonitor.class.getName());
    monitor.shutdown();
}
Also used : ServerLoadMonitor(org.directwebremoting.extend.ServerLoadMonitor)

Example 2 with ServerLoadMonitor

use of org.directwebremoting.extend.ServerLoadMonitor in project ma-core-public by infiniteautomation.

the class FileHandler method afterContainerSetup.

/* (non-Javadoc)
     * @see org.directwebremoting.extend.InitializingBean#afterContainerSetup(org.directwebremoting.Container)
     */
public void afterContainerSetup(Container container) {
    // TODO: Move this code into EngineHandler
    if (dynamic) {
        boolean streaming = true;
        // connection method.
        if (maxWaitAfterWrite > -1 && maxWaitAfterWrite < 500) {
            streaming = false;
        }
        // If the ServerLoadMonitor says no streaming, then obviously ...
        ServerLoadMonitor monitor = (ServerLoadMonitor) container.getBean(ServerLoadMonitor.class.getName());
        if (!monitor.supportsStreaming()) {
            streaming = false;
        }
        // Poll using XHR (to avoid IE clicking) if we close
        // the connection than 1sec after output happens.
        pollWithXhr = streaming ? "false" : "true";
    }
}
Also used : ServerLoadMonitor(org.directwebremoting.extend.ServerLoadMonitor)

Example 3 with ServerLoadMonitor

use of org.directwebremoting.extend.ServerLoadMonitor in project ma-core-public by infiniteautomation.

the class ContainerUtil method shutdownServerLoadMonitorsInContainerList.

/**
 * Internal use only.
 * <p>If we detect that the server is being shutdown then we want to kill
 * any reverse ajax threads.
 * @param containers The list of containers to look for ServerLoadMonitors in
 * @param title What causes this (for debug purposes)
 */
public static void shutdownServerLoadMonitorsInContainerList(List containers, String title) {
    if (containers == null || containers.size() == 0) {
        log.debug("No containers to shutdown for: " + title);
        return;
    }
    log.debug("Shutting down containers for: " + title);
    for (Iterator it = containers.iterator(); it.hasNext(); ) {
        Container container = (Container) it.next();
        ServerLoadMonitor monitor = (ServerLoadMonitor) container.getBean(ServerLoadMonitor.class.getName());
        monitor.shutdown();
    }
}
Also used : Container(org.directwebremoting.Container) ServerLoadMonitor(org.directwebremoting.extend.ServerLoadMonitor) Iterator(java.util.Iterator)

Aggregations

ServerLoadMonitor (org.directwebremoting.extend.ServerLoadMonitor)3 Iterator (java.util.Iterator)1 Container (org.directwebremoting.Container)1