Search in sources :

Example 11 with CFMLFactoryImpl

use of lucee.runtime.CFMLFactoryImpl in project Lucee by lucee.

the class Admin method fillGetRunningThreads.

private static void fillGetRunningThreads(lucee.runtime.type.Query qry, ConfigWeb configWeb) throws PageException {
    CFMLFactoryImpl factory = ((CFMLFactoryImpl) configWeb.getFactory());
    Map<Integer, PageContextImpl> pcs = factory.getActivePageContexts();
    Iterator<PageContextImpl> it = pcs.values().iterator();
    PageContextImpl pc;
    Collection.Key key;
    int row = 0;
    while (it.hasNext()) {
        pc = it.next();
        qry.addRow();
        row++;
        StackTraceElement[] st = pc.getThread().getStackTrace();
        configWeb.getConfigDir();
        configWeb.getIdentification().getId();
        configWeb.getConfigDir();
        qry.setAt("Id", row, new Double(pc.getId()));
        qry.setAt("Start", row, new DateTimeImpl(pc.getStartTime(), false));
        qry.setAt("Timeout", row, new Double(pc.getRequestTimeout() / 1000));
        qry.setAt("ThreadType", row, pc.getParentPageContext() == null ? "main" : "child");
        qry.setAt("StackTrace", row, toString(st));
        qry.setAt("TagContext", row, PageExceptionImpl.getTagContext(pc.getConfig(), st));
        qry.setAt("label", row, factory.getLabel());
        qry.setAt("RootPath", row, ReqRspUtil.getRootPath(((ConfigWebImpl) configWeb).getServletContext()));
        qry.setAt("ConfigFile", row, configWeb.getConfigFile().getAbsolutePath());
        if (factory.getURL() != null)
            qry.setAt("url", row, factory.getURL().toExternalForm());
    }
}
Also used : PageContextImpl(lucee.runtime.PageContextImpl) Key(lucee.runtime.type.Collection.Key) ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) CFMLFactoryImpl(lucee.runtime.CFMLFactoryImpl) BundleCollection(lucee.loader.osgi.BundleCollection) Collection(lucee.runtime.type.Collection) DateTimeImpl(lucee.runtime.type.dt.DateTimeImpl)

Example 12 with CFMLFactoryImpl

use of lucee.runtime.CFMLFactoryImpl in project Lucee by lucee.

the class CFMLEngineImpl method reset.

@Override
public void reset(String configId) {
    SystemOut.printDate("reset CFML Engine");
    getControler().close();
    RetireOutputStreamFactory.close();
    // release HTTP Pool
    HTTPEngine4Impl.releaseConnectionManager();
    releaseCache(getConfigServerImpl());
    CFMLFactoryImpl cfmlFactory;
    // ScopeContext scopeContext;
    try {
        Iterator<String> it = contextes.keySet().iterator();
        while (it.hasNext()) {
            try {
                cfmlFactory = (CFMLFactoryImpl) contextes.get(it.next());
                if (configId != null && !configId.equals(cfmlFactory.getConfigWebImpl().getIdentification().getId()))
                    continue;
                // scopes
                try {
                    cfmlFactory.getScopeContext().clear();
                } catch (Throwable t) {
                    ExceptionUtil.rethrowIfNecessary(t);
                }
                // PageContext
                try {
                    cfmlFactory.resetPageContext();
                } catch (Throwable t) {
                    ExceptionUtil.rethrowIfNecessary(t);
                }
                // Query Cache
                try {
                    PageContext pc = ThreadLocalPageContext.get();
                    if (pc != null) {
                        pc.getConfig().getCacheHandlerCollection(Config.CACHE_TYPE_QUERY, null).clear(pc);
                        pc.getConfig().getCacheHandlerCollection(Config.CACHE_TYPE_FUNCTION, null).clear(pc);
                        pc.getConfig().getCacheHandlerCollection(Config.CACHE_TYPE_INCLUDE, null).clear(pc);
                    }
                // cfmlFactory.getDefaultQueryCache().clear(null);
                } catch (Throwable t) {
                    ExceptionUtil.rethrowIfNecessary(t);
                }
                // Gateway
                try {
                    cfmlFactory.getConfigWebImpl().getGatewayEngine().reset();
                } catch (Throwable t) {
                    ExceptionUtil.rethrowIfNecessary(t);
                }
                // Cache
                releaseCache(cfmlFactory.getConfigWebImpl());
            } catch (Throwable t) {
                ExceptionUtil.rethrowIfNecessary(t);
            }
        }
        // release felix itself
        shutdownFelix();
    } finally {
        // Controller
        controlerState.setActive(false);
    }
}
Also used : CFMLFactoryImpl(lucee.runtime.CFMLFactoryImpl) PageContext(lucee.runtime.PageContext)

Example 13 with CFMLFactoryImpl

use of lucee.runtime.CFMLFactoryImpl in project Lucee by lucee.

the class CFMLEngineImpl method loadJSPFactory.

private CFMLFactoryImpl loadJSPFactory(ConfigServerImpl configServer, ServletConfig sg, int countExistingContextes) throws ServletException {
    try {
        if (XMLConfigWebFactory.LOG)
            SystemOut.printDate("load Context");
        // Load Config
        RefBoolean isCustomSetting = new RefBooleanImpl();
        Resource configDir = getConfigDirectory(sg, configServer, countExistingContextes, isCustomSetting);
        if (XMLConfigWebFactory.LOG)
            SystemOut.printDate("got context directory");
        CFMLFactoryImpl factory = new CFMLFactoryImpl(this, sg);
        if (XMLConfigWebFactory.LOG)
            SystemOut.printDate("init factory");
        ConfigWebImpl config = XMLConfigWebFactory.newInstance(this, factory, configServer, configDir, isCustomSetting.toBooleanValue(), sg);
        if (XMLConfigWebFactory.LOG)
            SystemOut.printDate("loaded config");
        factory.setConfig(config);
        return factory;
    } catch (Exception e) {
        ServletException se = new ServletException(e.getMessage());
        se.setStackTrace(e.getStackTrace());
        throw se;
    }
}
Also used : ServletException(javax.servlet.ServletException) PageServletException(lucee.runtime.exp.PageServletException) ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) RefBoolean(lucee.commons.lang.types.RefBoolean) CFMLFactoryImpl(lucee.runtime.CFMLFactoryImpl) Resource(lucee.commons.io.res.Resource) RefBooleanImpl(lucee.commons.lang.types.RefBooleanImpl) PageRuntimeException(lucee.runtime.exp.PageRuntimeException) PageException(lucee.runtime.exp.PageException) JspException(javax.servlet.jsp.JspException) NativeException(lucee.runtime.exp.NativeException) IOException(java.io.IOException) ServletException(javax.servlet.ServletException) URISyntaxException(java.net.URISyntaxException) PageServletException(lucee.runtime.exp.PageServletException) MalformedURLException(java.net.MalformedURLException) RequestTimeoutException(lucee.runtime.exp.RequestTimeoutException) ApplicationException(lucee.runtime.exp.ApplicationException)

Example 14 with CFMLFactoryImpl

use of lucee.runtime.CFMLFactoryImpl in project Lucee by lucee.

the class Surveillance method infoScopes.

private static void infoScopes(Struct web, Struct server, ConfigWeb config) throws PageException {
    ScopeContext sc = ((CFMLFactoryImpl) config.getFactory()).getScopeContext();
    DoubleStruct webScopes = new DoubleStruct();
    DoubleStruct srvScopes = new DoubleStruct();
    long s;
    s = sc.getScopesSize(Scope.SCOPE_SESSION);
    webScopes.set("session", Caster.toDouble(s));
    s = sc.getScopesSize(Scope.SCOPE_APPLICATION);
    webScopes.set("application", Caster.toDouble(s));
    s = sc.getScopesSize(Scope.SCOPE_CLUSTER);
    srvScopes.set("cluster", Caster.toDouble(s));
    s = sc.getScopesSize(Scope.SCOPE_SERVER);
    srvScopes.set("server", Caster.toDouble(s));
    s = sc.getScopesSize(Scope.SCOPE_CLIENT);
    webScopes.set("client", Caster.toDouble(s));
    web.set(KeyConstants._scopes, webScopes);
    server.set(KeyConstants._scopes, srvScopes);
}
Also used : ScopeContext(lucee.runtime.type.scope.ScopeContext) CFMLFactoryImpl(lucee.runtime.CFMLFactoryImpl) DoubleStruct(lucee.runtime.type.DoubleStruct)

Example 15 with CFMLFactoryImpl

use of lucee.runtime.CFMLFactoryImpl in project Lucee by lucee.

the class ApplicationStop method call.

public static String call(PageContext pc) throws PageException {
    CFMLFactoryImpl factory = (CFMLFactoryImpl) pc.getCFMLFactory();
    ScopeContext sc = factory.getScopeContext();
    sc.clearApplication(pc);
    return null;
}
Also used : ScopeContext(lucee.runtime.type.scope.ScopeContext) CFMLFactoryImpl(lucee.runtime.CFMLFactoryImpl)

Aggregations

CFMLFactoryImpl (lucee.runtime.CFMLFactoryImpl)20 PageContextImpl (lucee.runtime.PageContextImpl)7 ConfigWebImpl (lucee.runtime.config.ConfigWebImpl)7 Collection (lucee.runtime.type.Collection)5 ScopeContext (lucee.runtime.type.scope.ScopeContext)5 ConfigWeb (lucee.runtime.config.ConfigWeb)4 ApplicationException (lucee.runtime.exp.ApplicationException)4 Struct (lucee.runtime.type.Struct)4 StructImpl (lucee.runtime.type.StructImpl)4 BundleCollection (lucee.loader.osgi.BundleCollection)3 CFMLFactory (lucee.runtime.CFMLFactory)3 PageContext (lucee.runtime.PageContext)3 ConfigServer (lucee.runtime.config.ConfigServer)3 Key (lucee.runtime.type.Collection.Key)3 MalformedURLException (java.net.MalformedURLException)2 HttpServletRequest (javax.servlet.http.HttpServletRequest)2 ConfigServerImpl (lucee.runtime.config.ConfigServerImpl)2 ThreadLocalPageContext (lucee.runtime.engine.ThreadLocalPageContext)2 NativeException (lucee.runtime.exp.NativeException)2 PageServletException (lucee.runtime.exp.PageServletException)2