本文整理汇总了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;
}
示例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;
}
示例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");
}
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
}