赞
踩
package com.lastinglate.concurrent.chapter11; public final class ActionContext { private static final ThreadLocal<Context> threadLocal = new ThreadLocal<Context>() { @Override protected Context initialValue() { return new Context(); } }; private static class ContextHolder { private final static ActionContext actionContext = new ActionContext(); } public static ActionContext getActionContext() { return ContextHolder.actionContext; } public Context getContext() { return threadLocal.get(); } private ActionContext(){ } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。