当前位置: 首页>>代码示例>>Java>>正文


Java ContextBindings.bindThread方法代码示例

本文整理汇总了Java中org.apache.naming.ContextBindings.bindThread方法的典型用法代码示例。如果您正苦于以下问题:Java ContextBindings.bindThread方法的具体用法?Java ContextBindings.bindThread怎么用?Java ContextBindings.bindThread使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.naming.ContextBindings的用法示例。


在下文中一共展示了ContextBindings.bindThread方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: bindThread

import org.apache.naming.ContextBindings; //导入方法依赖的package包/类
/**
 * Bind current thread, both for CL purposes and for JNDI ENC support
 * during : startup, shutdown and realoading of the context.
 *
 * @return the previous context class loader
 */
private ClassLoader bindThread() {

    ClassLoader oldContextClassLoader =
        Thread.currentThread().getContextClassLoader();

    if (getResources() == null)
        return oldContextClassLoader;

    Thread.currentThread().setContextClassLoader
        (getLoader().getClassLoader());

    DirContextURLStreamHandler.bind(getResources());

    if (isUseNaming()) {
        try {
            ContextBindings.bindThread(this, this);
        } catch (NamingException e) {
            // Silent catch, as this is a normal case during the early
            // startup stages
        }
    }

    return oldContextClassLoader;

}
 
开发者ID:c-rainstorm,项目名称:jerrydog,代码行数:32,代码来源:StandardContext.java

示例2: bindThread

import org.apache.naming.ContextBindings; //导入方法依赖的package包/类
/**
 * Bind current thread, both for CL purposes and for JNDI ENC support during
 * : startup, shutdown and realoading of the context.
 *
 * @return the previous context class loader
 */
protected ClassLoader bindThread() {

	ClassLoader oldContextClassLoader = Thread.currentThread().getContextClassLoader();

	if (getResources() == null)
		return oldContextClassLoader;

	if (getLoader() != null && getLoader().getClassLoader() != null) {
		Thread.currentThread().setContextClassLoader(getLoader().getClassLoader());
	}

	DirContextURLStreamHandler.bindThread(getResources());

	if (isUseNaming()) {
		try {
			ContextBindings.bindThread(this, this);
		} catch (NamingException e) {
			// Silent catch, as this is a normal case during the early
			// startup stages
		}
	}

	return oldContextClassLoader;

}
 
开发者ID:how2j,项目名称:lazycat,代码行数:32,代码来源:StandardContext.java

示例3: contextEntered

import org.apache.naming.ContextBindings; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void contextEntered(final ThreadContext oldContext, final ThreadContext newContext) {
    // save off the old context if possible
    try {
        final Data data = new Data(getThreadName());
        newContext.set(Data.class, data);
    } catch (final NamingException ignored) {
        // no-op
    }

    // set the new context
    try {
        ContextBindings.bindThread(OPENEJB_CONTEXT, null);
    } catch (final NamingException e) {
        ContextBindings.unbindContext(OPENEJB_CONTEXT, null);
        throw new IllegalArgumentException("Unable to bind OpenEJB enc");
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:21,代码来源:TomcatThreadContextListener.java

示例4: bindThread

import org.apache.naming.ContextBindings; //导入方法依赖的package包/类
/**
 * Bind current thread, both for CL purposes and for JNDI ENC support
 * during : startup, shutdown and realoading of the context.
 *
 * @return the previous context class loader
 */
protected ClassLoader bindThread() {

    ClassLoader oldContextClassLoader =
        Thread.currentThread().getContextClassLoader();

    if (getResources() == null)
        return oldContextClassLoader;

    if (getLoader() != null && getLoader().getClassLoader() != null) {
        Thread.currentThread().setContextClassLoader
            (getLoader().getClassLoader());
    }

    DirContextURLStreamHandler.bindThread(getResources());

    if (isUseNaming()) {
        try {
            ContextBindings.bindThread(this, this);
        } catch (NamingException e) {
            // Silent catch, as this is a normal case during the early
            // startup stages
        }
    }

    return oldContextClassLoader;

}
 
开发者ID:liaokailin,项目名称:tomcat7,代码行数:34,代码来源:StandardContext.java

示例5: bindThread

import org.apache.naming.ContextBindings; //导入方法依赖的package包/类
/**
 * Bind current thread, both for CL purposes and for JNDI ENC support
 * during : startup, shutdown and realoading of the context.
 *
 * @return the previous context class loader
 */
private ClassLoader bindThread() {

    ClassLoader oldContextClassLoader =
        Thread.currentThread().getContextClassLoader();

    if (getResources() == null)
        return oldContextClassLoader;

    if (getLoader().getClassLoader() != null) {
        Thread.currentThread().setContextClassLoader
            (getLoader().getClassLoader());
    }

    DirContextURLStreamHandler.bind(getResources());

    if (isUseNaming()) {
        try {
            ContextBindings.bindThread(this, this);
        } catch (NamingException e) {
            // Silent catch, as this is a normal case during the early
            // startup stages
        }
    }

    return oldContextClassLoader;

}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:34,代码来源:StandardContext.java

示例6: bindThread

import org.apache.naming.ContextBindings; //导入方法依赖的package包/类
/**
 * Bind current thread, both for CL purposes and for JNDI ENC support
 * during : startup, shutdown and realoading of the context.
 *
 * @return the previous context class loader
 */
protected ClassLoader bindThread() {

    ClassLoader oldContextClassLoader =
        Thread.currentThread().getContextClassLoader();

    if (getResources() == null)
        return oldContextClassLoader;

    if (getLoader().getClassLoader() != null) {
        Thread.currentThread().setContextClassLoader
            (getLoader().getClassLoader());
    }

    DirContextURLStreamHandler.bindThread(getResources());

    if (isUseNaming()) {
        try {
            ContextBindings.bindThread(this, this);
        } catch (NamingException e) {
            // Silent catch, as this is a normal case during the early
            // startup stages
        }
    }

    return oldContextClassLoader;

}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:34,代码来源:StandardContext.java

示例7: contextExited

import org.apache.naming.ContextBindings; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
public void contextExited(final ThreadContext exitedContext, final ThreadContext reenteredContext) {
    // unbind the new context
    ContextBindings.unbindThread(OPENEJB_CONTEXT, null);

    // attempt to restore the old context
    final Data data = exitedContext.get(Data.class);
    if (data != null && data.oldContextName != null) {
        try {
            ContextBindings.bindThread(data.oldContextName, null);
        } catch (final NamingException e) {
            logger.error("Exception in method contextExited", e);
        }
    }
}
 
开发者ID:apache,项目名称:tomee,代码行数:18,代码来源:TomcatThreadContextListener.java


注:本文中的org.apache.naming.ContextBindings.bindThread方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。