code: @SuppressWarnings("unchecked")
     public void popContext(Set unsharableResources) throws ResourceException
     {
        LinkedList<Context> stack = threadContexts.get();
  
        if (stack == null || stack.isEmpty())
           return;
  
        Context context = stack.removeLast();
  
        if (log.isTraceEnabled())
        {
           if (!stack.isEmpty())
           {
              log.tracef("pop: old stack for context: %s", context);
              log.tracef("pop: new stack for context: %s", stack.getLast());
           }
           else
           {
              log.tracef("pop: old stack for context: %s", context);
           }
        }
  
        if (Tracer.isEnabled())
           Tracer.popCCMContext(context.toString(), new Throwable("CALLSTACK"));
  
        if (debug && closeAll(context) && error)
        {
           throw new ResourceException(bundle.someConnectionsWereNotClosed());
        }
  
        context.clear();
     }
docs: {@inheritDoc}