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;
}
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);
}
}
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());
}
}
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;
}
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());
}
}
Aggregations