Package com.astamuse.asta4d

Examples of com.astamuse.asta4d.Context


     * @param doSynchronize
     */
    public ContextBindData(boolean contextSynchronizable) {
        this.contextSynchronizable = contextSynchronizable;
        if (contextSynchronizable) {
            Context context = Context.getCurrentThreadContext();
            ConcurrentMap<String, Object> map = context.getData(MapKey);
            Object obj = map.get(bindKey);
            if (obj == null) {
                obj = new DataWithLock();
                obj = map.putIfAbsent(bindKey, obj);
            }
View Full Code Here


    public T get() {
        if (contextSynchronizable) {
            return getDataSynchronously();
        } else {
            Context context = Context.getCurrentThreadContext();
            T data = context.getData(bindKey);
            if (data == null) {
                data = buildData();
                context.setData(bindKey, data);
            }
            return data;
        }

    }
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    private T getDataSynchronously() {
        Context context = Context.getCurrentThreadContext();
        ConcurrentMap<String, Object> map = context.getData(MapKey);

        // map will not be null since we have initialized it in constructor
        DataWithLock dl = (DataWithLock) map.get(bindKey);
        if (!dl.valid) {
            Object data;
View Full Code Here

    public static final void saveMethodInjectionTraceInfo(Method method, int parameterIndex, ContextDataHolder valueHolder) {
        saveInstanceInjectionTraceInfo(null, createTraceKey(method, parameterIndex), valueHolder);
    }

    private static final void saveInstanceInjectionTraceInfo(Object instance, String traceKey, ContextDataHolder valueHolder) {
        Context context = Context.getCurrentThreadContext();
        InstanceTraceList traceList = context.getData(InstanceTraceListSaveKey);
        if (traceList == null) {
            traceList = new InstanceTraceList();
            context.setData(InstanceTraceListSaveKey, traceList);
        }
        synchronized (traceList) {
            TraceMap traceMap = null;
            for (TraceMap map : traceList) {
                if (map.targetInstance == instance) {
View Full Code Here

    public static final ContextDataHolder getMethodInjectionTraceInfo(Method method, int parameterIndex) {
        return getInstanceInjectionTraceInfo(null, createTraceKey(method, parameterIndex));
    }

    private static final ContextDataHolder getInstanceInjectionTraceInfo(Object instance, String traceKey) {
        Context context = Context.getCurrentThreadContext();
        InstanceTraceList traceList = context.getData(InstanceTraceListSaveKey);
        if (traceList == null) {
            return null;
        }
        synchronized (traceList) {
            TraceMap traceMap = null;
View Full Code Here

        return true;
    }

    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        Context asta4dContext = Context.getCurrentThreadContext();
        if (asta4dContext != null) {
            asta4dContext.clear();
        }
        super.afterCompletion(request, response, handler, ex);
    }
View Full Code Here

TOP

Related Classes of com.astamuse.asta4d.Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.