Search in sources :

Example 6 with CFMLFactoryImpl

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

the class GetSystemInfo method call.

public static Struct call(PageContext pc) throws PageException {
    Struct sct = new StructImpl();
    ConfigWebImpl config = (ConfigWebImpl) pc.getConfig();
    CFMLFactoryImpl factory = (CFMLFactoryImpl) config.getFactory();
    ScopeContext sc = factory.getScopeContext();
    // OperatingSystemMXBean osBean = (OperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean();
    // threads/requests
    sct.put("activeRequests", factory.getActiveRequests());
    sct.put("activeThreads", factory.getActiveThreads());
    sct.put("queueRequests", config.getThreadQueue().size());
    // Datasource connections
    sct.put("activeDatasourceConnections", getConnections(config));
    // tasks
    sct.put("tasksOpen", config.getSpoolerEngine().getOpenTaskCount());
    sct.put("tasksClosed", config.getSpoolerEngine().getClosedTaskCount());
    // scopes
    sct.put("sessionCount", sc.getSessionCount());
    sct.put("clientCount", sc.getClientCount());
    sct.put("applicationContextCount", sc.getAppContextCount());
    return sct;
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) StructImpl(lucee.runtime.type.StructImpl) ScopeContext(lucee.runtime.type.scope.ScopeContext) CFMLFactoryImpl(lucee.runtime.CFMLFactoryImpl) Struct(lucee.runtime.type.Struct)

Example 7 with CFMLFactoryImpl

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

the class ScopeContext method clearApplication.

public void clearApplication(PageContext pc) throws PageException {
    if (applicationContexts.size() == 0)
        throw new ApplicationException("there is no application context defined");
    String name = pc.getApplicationContext().getName();
    CFMLFactoryImpl jspFactory = (CFMLFactoryImpl) pc.getCFMLFactory();
    Application application = applicationContexts.get(name);
    if (application == null)
        throw new ApplicationException("there is no application context defined with name [" + name + "]");
    ApplicationListener listener = PageContextUtil.getApplicationListener(pc);
    application.touch();
    try {
        listener.onApplicationEnd(jspFactory, name);
    } finally {
        applicationContexts.remove(name);
        application.release(pc);
    }
}
Also used : ApplicationException(lucee.runtime.exp.ApplicationException) CFMLFactoryImpl(lucee.runtime.CFMLFactoryImpl) ApplicationListener(lucee.runtime.listener.ApplicationListener)

Example 8 with CFMLFactoryImpl

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

the class Admin method doGetContexts.

/**
 * @throws PageException
 */
private void doGetContexts() throws PageException {
    CFMLFactory[] factories;
    if (config instanceof ConfigServerImpl) {
        ConfigServerImpl cs = (ConfigServerImpl) config;
        factories = cs.getJSPFactories();
    } else {
        ConfigWebImpl cw = (ConfigWebImpl) config;
        factories = new CFMLFactory[] { cw.getFactory() };
    }
    lucee.runtime.type.Query qry = new QueryImpl(new Collection.Key[] { KeyConstants._path, KeyConstants._id, KeyConstants._hash, KeyConstants._label, HAS_OWN_SEC_CONTEXT, KeyConstants._url, CONFIG_FILE, CLIENT_SIZE, CLIENT_ELEMENTS, SESSION_SIZE, SESSION_ELEMENTS }, factories.length, getString("admin", action, "returnVariable"));
    pageContext.setVariable(getString("admin", action, "returnVariable"), qry);
    ConfigWebImpl cw;
    for (int i = 0; i < factories.length; i++) {
        int row = i + 1;
        CFMLFactoryImpl factory = (CFMLFactoryImpl) factories[i];
        cw = (ConfigWebImpl) factory.getConfig();
        qry.setAtEL(KeyConstants._path, row, ReqRspUtil.getRootPath(factory.getConfigWebImpl().getServletContext()));
        qry.setAtEL(CONFIG_FILE, row, factory.getConfigWebImpl().getConfigFile().getAbsolutePath());
        if (factory.getURL() != null)
            qry.setAtEL(KeyConstants._url, row, factory.getURL().toExternalForm());
        qry.setAtEL(KeyConstants._id, row, factory.getConfig().getIdentification().getId());
        qry.setAtEL(KeyConstants._hash, row, SystemUtil.hash(factory.getConfigWebImpl().getServletContext()));
        qry.setAtEL(KeyConstants._label, row, factory.getLabel());
        qry.setAtEL(HAS_OWN_SEC_CONTEXT, row, Caster.toBoolean(cw.hasIndividualSecurityManager()));
        setScopeDirInfo(qry, row, CLIENT_SIZE, CLIENT_ELEMENTS, cw.getClientScopeDir());
        setScopeDirInfo(qry, row, SESSION_SIZE, SESSION_ELEMENTS, cw.getSessionScopeDir());
    }
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) QueryImpl(lucee.runtime.type.QueryImpl) CFMLFactoryImpl(lucee.runtime.CFMLFactoryImpl) BundleCollection(lucee.loader.osgi.BundleCollection) Collection(lucee.runtime.type.Collection) CFMLFactory(lucee.runtime.CFMLFactory) ConfigServerImpl(lucee.runtime.config.ConfigServerImpl) Query(lucee.runtime.type.Query)

Example 9 with CFMLFactoryImpl

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

the class Admin method terminateRunningThread.

private static boolean terminateRunningThread(ConfigWeb configWeb, int id) {
    Map<Integer, PageContextImpl> pcs = ((CFMLFactoryImpl) configWeb.getFactory()).getActivePageContexts();
    Iterator<PageContextImpl> it = pcs.values().iterator();
    PageContextImpl pc;
    Collection.Key key;
    while (it.hasNext()) {
        pc = it.next();
        if (pc.getId() == id) {
            CFMLFactoryImpl.terminate(pc, true);
            return true;
        }
    }
    return false;
}
Also used : Key(lucee.runtime.type.Collection.Key) CFMLFactoryImpl(lucee.runtime.CFMLFactoryImpl) BundleCollection(lucee.loader.osgi.BundleCollection) Collection(lucee.runtime.type.Collection) PageContextImpl(lucee.runtime.PageContextImpl)

Example 10 with CFMLFactoryImpl

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

the class Admin method doSurveillance.

private void doSurveillance() throws PageException {
    // Server
    if (config instanceof ConfigServer) {
        ConfigServer cs = (ConfigServer) config;
        ConfigWeb[] webs = cs.getConfigWebs();
        Struct sct = new StructImpl();
        for (int i = 0; i < webs.length; i++) {
            ConfigWebImpl cw = (ConfigWebImpl) webs[i];
            try {
                sct.setEL(cw.getIdentification().getId(), ((CFMLFactoryImpl) cw.getFactory()).getInfo());
            } catch (Throwable t) {
                ExceptionUtil.rethrowIfNecessary(t);
            }
        }
        pageContext.setVariable(getString("admin", action, "returnVariable"), sct);
    } else // Web
    {
        CFMLFactoryImpl factory = (CFMLFactoryImpl) ((ConfigWeb) config).getFactory();
        pageContext.setVariable(getString("admin", action, "returnVariable"), factory.getInfo());
    }
}
Also used : ConfigWebImpl(lucee.runtime.config.ConfigWebImpl) StructImpl(lucee.runtime.type.StructImpl) CFMLFactoryImpl(lucee.runtime.CFMLFactoryImpl) ConfigServer(lucee.runtime.config.ConfigServer) ConfigWeb(lucee.runtime.config.ConfigWeb) Struct(lucee.runtime.type.Struct)

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