Save off the context data for the current thread
508237
public HashMap<String,Object> saveContextData(){
        HashMap<String,Object> contextData = new HashMap<String, Object>();      
        //Save off the data from the other components we have hooks into
        ComponentMetaDataAccessorImpl cmdai = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor();
        ComponentMetaData cmd = cmdai.getComponentMetaData();
        if (cmd != null) {
          contextData.put(ComponentMetaData, cmd);
        }  
        
        //Each producer service of the Transfer service is accessed in order to get the thread context data
        //The context data is then stored off
        Iterator<ITransferContextService> TransferIterator = com.ibm.ws.webcontainer.osgi.WebContainer.getITransferContextServices();
        if (TransferIterator != null) {
            while(TransferIterator.hasNext()){
                ITransferContextService tcs = TransferIterator.next();
                
                if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                    Tr.debug(tc, "Calling storeState on: " + tcs);
                }
                tcs.storeState(contextData);
            }
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "No implmenting services found");
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "Saving the context data : " + contextData);
        }
        return contextData;
    }
75069
private ThreadContext getOrCreateContext(Channel channel) {
    ThreadContext context = ThreadContext.currentContext();
    if (context != null) {
      return context;
    }
    return new SingleThreadContext(Thread.currentThread(), channel.eventLoop(), this.context.serializer().clone());
  }
749795
def get_context_data(self, **kwargs):
        """"""
        
        context = super(AnimalListAlive, self).get_context_data(**kwargs)
        context['list_type'] = 'Alive'
        return context
1197657
@SuppressWarnings("deprecation")
  public void pushContextData() {
    if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINEST)) { 
      logger.entering(CLASS_NAME,"pushContextData",this);
    }

    // will want to run on the calling thread's class loader
    this.newCL = AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() {
        @Override
        public ClassLoader run() {
            ClassLoader old = Thread.currentThread().getContextClassLoader();
            return old;
        }
    });

    if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINEST)) {
        logger.logp(Level.FINEST, CLASS_NAME, "pushContextData", "thread context class loader [" + this.newCL +"]");
      }
    
    this.contextData = new HashMap();
    
    // push data for other components that we already have hooks into
    ComponentMetaDataAccessorImpl cmdai = ComponentMetaDataAccessorImpl.getComponentMetaDataAccessor();
    ComponentMetaData cmd = cmdai.getComponentMetaData();
    if (cmd != null) {
      this.contextData.put(ComponentMetaData, cmd);
    }  
    
    // each producer service of the Transfer service is accessed in order to get the thread context data
    Iterator<ITransferContextService> TransferIterator = com.ibm.ws.webcontainer.osgi.WebContainer.getITransferContextServices();
    if (TransferIterator != null) { 
      while(TransferIterator.hasNext()){
        ITransferContextService tcs = TransferIterator.next();
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINEST)) {
          logger.logp(Level.FINEST, CLASS_NAME, "pushContextData", "calling storeState on: " + tcs);
        }
        tcs.storeState(this.contextData);
        asyncContext.storeStateCtxData = this.contextData;
      }
    } else {
      if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && logger.isLoggable(Level.FINEST)) {
        logger.logp(Level.FINEST, CLASS_NAME, "pushContextData", "no implmenting services found");
      }
    }
    
    if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled()&&logger.isLoggable (Level.FINEST)) { 
      logger.exiting(CLASS_NAME,"pushContextData",this);
    }
  }
1139402
def get_context_data(self, parent_context, *tag_args, **tag_kwargs):
        
        target_object = tag_args[0]  # moved one spot due to .pop(0)
        new_context = {
            'STATIC_URL': parent_context.get('STATIC_URL', None),
            'USE_THREADEDCOMMENTS': appsettings.USE_THREADEDCOMMENTS,
            'target_object': target_object,
        }

        # Be configuration independent:
        if new_context['STATIC_URL'] is None:
            try:
                request = parent_context['request']
            except KeyError:
                new_context.update({'STATIC_URL': settings.STATIC_URL})
            else:
                new_context.update(context_processors.static(request))

        return new_context
639761
public Object saveState(FacesContext context) {
        if (context == null) {
            throw new NullPointerException();
        }
        Object values[] = new Object[1];
        values[0] = methodExpression;
        return (values);

    }
284622
private void dumpThreads() {

        if (LOG.isDebugEnabled()) {
            StringBuffer b = new StringBuffer(512);
            Iterator<CmsUUID> i = m_threads.keySet().iterator();
            while (i.hasNext()) {
                CmsUUID key = i.next();
                A_CmsReportThread thread = m_threads.get(key);
                b.append(thread.getName());
                b.append(" - ");
                b.append(thread.getUUID());
                b.append('\n');
            }
            LOG.debug(
                Messages.get().getBundle().key(
                    Messages.LOG_THREADSTORE_POOL_CONTENT_2,
                    new Integer(m_threads.size()),
                    b.toString()));
        }
    }
253841
static void saveCurrentSession(Context context, LogMonitorSession session) {
		if (context == null) {
			throw new IllegalArgumentException("Context is null");
		}

		if (session == null) {
			throw new IllegalArgumentException("Session is null");
		}

		SharedPreferences prefs = getPrefs(context);
		SharedPreferences.Editor editor = prefs.edit();
		editor.putString(PREFS_KEY_EMAIL_RECIPIENTS, StringUtils.join(session.emailRecipients));
		editor.apply();
	}
636920
private void setCurrent(Map<String, Object> current) {
        if (current instanceof Context) {
            throw new IllegalArgumentException("Don't using the " + Context.class.getName()
                    + " object as a parameters, it's implicitly delivery by thread-local. parameter context: "
                    + ((Context) current).thread.getName() + ", current context: " + thread.getName());
        }
        this.current = current;
    }
887342
function() {
      var threadsToKeep = {};
      for (var tid in this.threads) {
        var thread = this.threads[tid];
        if (!thread.isEmpty)
          threadsToKeep[tid] = thread;
      }
      this.threads = threadsToKeep;
    }
528477
@Override
    public void saveRDD(T t) {
        SaveAction<T> saveAction = new SaveAction<>(t);

        channel.writeAndFlush(saveAction);

        Response response;
        boolean interrupted = false;
        for (; ; ) {
            try {
                response = answer.take();
                break;
            } catch (InterruptedException ignore) {
                interrupted = true;
            }
        }

        if (interrupted) {
            Thread.currentThread().interrupt();
        }

        return;
    }
147500
public static Context pushContext(Map<String, Object> current) {
        Context context = new Context(getContext(), current);
        LOCAL.set(context);
        return context;
    }
56282
def get_context_data(self, **kwargs):
        
        context = super(ForumView, self).get_context_data(**kwargs)

        # Insert the considered forum into the context
        context['forum'] = self.get_forum()

        # Get the list of forums that have the current forum as parent
        context['sub_forums'] = ForumVisibilityContentTree.from_forums(
            self.request.forum_permission_handler.forum_list_filter(
                context['forum'].get_descendants(), self.request.user,
            ),
        )

        # The announces will be displayed on each page of the forum
        context['announces'] = list(
            self.get_forum()
            .topics.select_related('poster', 'last_post', 'last_post__poster')
            .filter(type=Topic.TOPIC_ANNOUNCE)
        )

        # Determines the topics that have not been read by the current user
        context['unread_topics'] = TrackingHandler(self.request).get_unread_topics(
            list(context[self.context_object_name]) + context['announces'], self.request.user,
        )

        return context
902845
def _save_trace(self):
        
        stack_trace = stack()
        try:
            self.trace = []
            for frm in stack_trace[5:]: # eliminate our own overhead
                self.trace.insert(0, frm[1:])
        finally:
            del stack_trace
481955
def get_context_data(self, **kwargs):
        """"""
        data = super(GaugesView, self).get_context_data(**kwargs)
        data.update({'gauges': get_r().gauge_slugs()})
        return data
39738
def get_context_data(self, **kwargs):
        
        context = super().get_context_data(**kwargs)
        topic = self.get_topic()

        # Add the previous posts to the context
        previous_posts = (
            topic.posts.filter(approved=True)
            .select_related('poster', 'updated_by')
            .prefetch_related('attachments', 'poster__forum_profile')
            .order_by('-created')
        )
        previous_posts = previous_posts[:machina_settings.TOPIC_REVIEW_POSTS_NUMBER]
        context['previous_posts'] = previous_posts

        return context
355401
public void dumpContext(PrintWriter writer) {
        try {
            NamingEnumeration<NameClassPair> list = context.list("/");
            writer.print("\n{\n  name: \"");
            /*writer.print(this.namespace);
            writer.print(" ");*/
            writer.print(this.root);
            writer.println("\",\n  children: [");
            enumerate(list, "/", writer);
            writer.println("]}");
            writer.flush();
        } catch (NamingException e) {
            e.printStackTrace(writer);
        }
    }