Search in sources :

Example 16 with Log

use of lucee.commons.io.log.Log in project Lucee by lucee.

the class FDThreadImpl method stop.

@Override
public void stop() {
    Log log = pc.getConfig().getLog("application");
    SystemUtil.stop(pc, log, true);
}
Also used : Log(lucee.commons.io.log.Log)

Example 17 with Log

use of lucee.commons.io.log.Log in project Lucee by lucee.

the class CFMLFactoryImpl method terminate.

public static void terminate(PageContextImpl pc, boolean async) {
    Log log = ((ConfigImpl) pc.getConfig()).getLog("requesttimeout");
    if (log != null)
        LogUtil.log(log, Log.LEVEL_ERROR, "controler", "stop thread (" + pc.getId() + ") because run into a timeout " + getPath(pc) + "." + RequestTimeoutException.locks(pc), pc.getThread().getStackTrace());
    pc.getConfig().getThreadQueue().exit(pc);
    SystemUtil.stop(pc, log, async);
}
Also used : Log(lucee.commons.io.log.Log) ConfigImpl(lucee.runtime.config.ConfigImpl)

Example 18 with Log

use of lucee.commons.io.log.Log in project Lucee by lucee.

the class CFMLFactoryImpl method stopThread.

public void stopThread(String threadId, String stopType) {
    // synchronized (runningPcs) {
    Iterator<PageContextImpl> it = runningPcs.values().iterator();
    PageContext pc;
    while (it.hasNext()) {
        pc = it.next();
        Log log = ((ConfigImpl) pc.getConfig()).getLog("application");
        try {
            String id = Hash.call(pc, pc.getId() + ":" + pc.getStartTime());
            if (id.equals(threadId)) {
                stopType = stopType.trim();
                // Throwable t;
                if ("abort".equalsIgnoreCase(stopType) || "cfabort".equalsIgnoreCase(stopType))
                    throw new RuntimeException("type [" + stopType + "] is no longer supported");
                // t=new Abort(Abort.SCOPE_REQUEST);
                // else t=new RequestTimeoutException(pc.getThread(),"request has been forced to stop.");
                SystemUtil.stop(pc, log, true);
                SystemUtil.sleep(10);
                break;
            }
        } catch (PageException e1) {
        }
    }
// }
}
Also used : PageException(lucee.runtime.exp.PageException) Log(lucee.commons.io.log.Log) ThreadLocalPageContext(lucee.runtime.engine.ThreadLocalPageContext) ConfigImpl(lucee.runtime.config.ConfigImpl)

Example 19 with Log

use of lucee.commons.io.log.Log in project Lucee by lucee.

the class ConfigWebUtil method loadLib.

static void loadLib(ConfigServerImpl configServer, ConfigImpl config) throws IOException {
    // get lib and classes resources
    Resource lib = config.getLibraryDirectory();
    Resource[] libs = lib.listResources(ExtensionResourceFilter.EXTENSION_JAR_NO_DIR);
    // get resources from server config and merge
    if (configServer != null) {
        ResourceClassLoader rcl = configServer.getResourceClassLoader();
        libs = ResourceUtil.merge(libs, rcl.getResources());
    }
    CFMLEngine engine = ConfigWebUtil.getEngine(config);
    BundleContext bc = engine.getBundleContext();
    Log log = config.getLog("application");
    BundleFile bf;
    List<Resource> list = new ArrayList<Resource>();
    for (int i = 0; i < libs.length; i++) {
        try {
            bf = BundleFile.newInstance(libs[i]);
            // jar is not a bundle
            if (bf == null) {
                // convert to a bundle
                BundleBuilderFactory factory = new BundleBuilderFactory(libs[i]);
                factory.setVersion("0.0.0.0");
                Resource tmp = SystemUtil.getTempFile("jar", false);
                factory.build(tmp);
                IOUtil.copy(tmp, libs[i]);
                bf = BundleFile.newInstance(libs[i]);
            }
            OSGiUtil.start(OSGiUtil.installBundle(bc, libs[i], true));
        } catch (Throwable t) {
            ExceptionUtil.rethrowIfNecessary(t);
            list.add(libs[i]);
            log.log(Log.LEVEL_ERROR, "OSGi", t);
        }
    }
    // set classloader
    ClassLoader parent = SystemUtil.getCoreClassLoader();
    config.setResourceClassLoader(new ResourceClassLoader(list.toArray(new Resource[list.size()]), parent));
}
Also used : Log(lucee.commons.io.log.Log) Resource(lucee.commons.io.res.Resource) ArrayList(java.util.ArrayList) BundleBuilderFactory(lucee.runtime.osgi.BundleBuilderFactory) ResourceClassLoader(lucee.commons.io.res.util.ResourceClassLoader) ResourceClassLoader(lucee.commons.io.res.util.ResourceClassLoader) CFMLEngine(lucee.loader.engine.CFMLEngine) BundleFile(lucee.runtime.osgi.BundleFile) BundleContext(org.osgi.framework.BundleContext)

Example 20 with Log

use of lucee.commons.io.log.Log in project Lucee by lucee.

the class StorageScopeDatasource method unstore.

@Override
public void unstore(PageContext pc) {
    ConfigImpl ci = (ConfigImpl) ThreadLocalPageContext.getConfig(pc);
    DatasourceConnection dc = null;
    DatasourceConnectionPool pool = ci.getDatasourceConnectionPool();
    Log log = ci.getLog("scope");
    try {
        // FUTURE change method interface
        pc = ThreadLocalPageContext.get(pc);
        DataSource ds;
        if (pc != null)
            ds = pc.getDataSource(datasourceName);
        else
            ds = ci.getDataSource(datasourceName);
        dc = pool.getDatasourceConnection(null, ds, null, null);
        SQLExecutor executor = SQLExecutionFactory.getInstance(dc);
        executor.delete(ci, cfid, appName, dc, getType(), log);
    } catch (Throwable t) {
        ExceptionUtil.rethrowIfNecessary(t);
        ScopeContext.error(log, t);
    } finally {
        if (dc != null)
            pool.releaseDatasourceConnection(dc);
    }
}
Also used : DatasourceConnection(lucee.runtime.db.DatasourceConnection) DatasourceConnectionPool(lucee.runtime.db.DatasourceConnectionPool) Log(lucee.commons.io.log.Log) SQLExecutor(lucee.runtime.type.scope.storage.db.SQLExecutor) ConfigImpl(lucee.runtime.config.ConfigImpl) DataSource(lucee.runtime.db.DataSource)

Aggregations

Log (lucee.commons.io.log.Log)35 ConfigImpl (lucee.runtime.config.ConfigImpl)14 PageException (lucee.runtime.exp.PageException)10 Resource (lucee.commons.io.res.Resource)8 ApplicationException (lucee.runtime.exp.ApplicationException)8 DatasourceConnection (lucee.runtime.db.DatasourceConnection)7 Struct (lucee.runtime.type.Struct)6 SQLException (java.sql.SQLException)5 ZipInputStream (java.util.zip.ZipInputStream)5 DataSource (lucee.runtime.db.DataSource)5 InputStream (java.io.InputStream)4 ZipEntry (java.util.zip.ZipEntry)4 StructImpl (lucee.runtime.type.StructImpl)4 ByteArrayInputStream (java.io.ByteArrayInputStream)3 IOException (java.io.IOException)3 HashMap (java.util.HashMap)3 Entry (java.util.Map.Entry)3 Attributes (java.util.jar.Attributes)3 DatabaseException (lucee.runtime.exp.DatabaseException)3 Key (lucee.runtime.type.Collection.Key)3