本文整理匯總了Java中org.kuali.rice.core.framework.util.ApplicationThreadLocal類的典型用法代碼示例。如果您正苦於以下問題:Java ApplicationThreadLocal類的具體用法?Java ApplicationThreadLocal怎麽用?Java ApplicationThreadLocal使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ApplicationThreadLocal類屬於org.kuali.rice.core.framework.util包,在下文中一共展示了ApplicationThreadLocal類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setApplicationContext
import org.kuali.rice.core.framework.util.ApplicationThreadLocal; //導入依賴的package包/類
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
// register a context close handler
if (applicationContext instanceof ConfigurableApplicationContext) {
ConfigurableApplicationContext context = (ConfigurableApplicationContext) applicationContext;
context.addApplicationListener(new ApplicationListener<ContextClosedEvent>() {
@Override
public void onApplicationEvent(ContextClosedEvent e) {
LOG.info("Context '" + e.getApplicationContext().getDisplayName() + "' closed, removing registered ApplicationThreadLocals");
if (!ApplicationThreadLocal.clear()) {
LOG.error("Error(s) occurred removing registered ApplicationThreadLocals");
}
}
});
}
}