Gets the audit thread context that is unique per thread.
If/when a common thread storage framework is supplied, then this method
implementation may need to be updated to take it into consideration.

@return the subject thread context.
558354
@Trivial
    protected AuditThreadContext getAuditThreadContext() {
        ThreadLocal<AuditThreadContext> currentThreadLocal = getThreadLocal();
        AuditThreadContext auditThreadContext = currentThreadLocal.get();
        if (auditThreadContext == null) {
            auditThreadContext = new AuditThreadContext();
            currentThreadLocal.set(auditThreadContext);
        }
        return auditThreadContext;
    }
280514
public static ExecutorService getSecurityContextAwareExecutor(ExecutorService original) {
        SubjectAwareExecutorService subjectAwareExecutor = new SubjectAwareExecutorService(original);
        return ThreadLocalUtil.contextAwareExecutor(subjectAwareExecutor);
    }
508430
public static synchronized ContextHolder getInstance() {

        if (INSTANCE == null) {
            Properties props = new Properties();
            try {
                props.load(new ClassPathResource("/cudafunctions.properties", ContextHolder.class.getClassLoader()).getInputStream());
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

            INSTANCE = new ContextHolder();
            INSTANCE.configure();


            //set the properties to be accessible globally
            for (String pair : props.stringPropertyNames())
                System.getProperties().put(pair, props.getProperty(pair));


        }


        return INSTANCE;
    }
750995
public static ClassLoader getContextClassLoader(Class<?> contextClass) {
        return Objects.firstNonNull(
                Thread.currentThread().getContextClassLoader(),
                contextClass.getClassLoader()
        );
    }
1199683
@SuppressWarnings("unchecked")
    public static ISharedContext<IUser> getUserContext() {
        return (ISharedContext<IUser>) ContextManager.getInstance().getSharedContext(UserContext.class.getName());
    }
410726
def get_context():
    
    pid = os.getpid()
    if pid not in context:
        context[pid] = zmq.Context()
        logger.debug('renewed context for PID %d', pid)
    return context[pid]
626465
@SuppressWarnings("unchecked")
    public final V getIfExists() {
        InternalThreadLocalMap threadLocalMap = InternalThreadLocalMap.getIfSet();
        if (threadLocalMap != null) {
            Object v = threadLocalMap.indexedVariable(index);
            if (v != InternalThreadLocalMap.UNSET) {
                return (V) v;
            }
        }
        return null;
    }
460136
protected ThreadFactory getThreadFactory() {
        return new ThreadFactory() {
            private final ThreadFactory parent = Executors.defaultThreadFactory();
            private final AtomicInteger tid = new AtomicInteger(1);

            @Override
            public Thread newThread(final Runnable task) {
              final Thread t = parent.newThread(task);
              t.setName(THREAD_PREFIX + tid.getAndIncrement());
              return t;
            }
          };
    }
1206
protected T getContext() {

        Chronology<T> c = this.getChronology();
        Class<T> type = c.getChronoType();

        if (type.isInstance(this)) {
            return type.cast(this);
        } else {
            for (ChronoElement<?> element : c.getRegisteredElements()) {
                if (type == element.getType()) {
                    return type.cast(this.get(element));
                }
            }
        }

        throw new IllegalStateException(
            "Implementation error: Cannot find entity context.");

    }
104384
@Override
    public ThreadContext captureThreadContext(Map<String, String> execProps, Map<String, ?> threadContextConfig) {
        throw new UnsupportedOperationException("captureThreadContext");
    }
146053
def get_logger_with_thread_id(context):
    
    logger = LoggingSessionContext.get_logger_for_context(context)
    child = logger.getChild(threading.currentThread().name)
    for handler in logger.handlers:
        child.addHandler(handler)
    child.level = logger.level
    for log_filter in logger.filters:
        child.addFilter(log_filter)
    return child
161596
protected LoggerContext getContext(final Class<?> callerClass) {
        ClassLoader cl = null;
        if (callerClass != null) {
            cl = callerClass.getClassLoader();
        }
        if (cl == null) {
            cl = LoaderUtil.getThreadContextClassLoader();
        }
        return LogManager.getContext(cl, false);
    }
481435
private static <T> ThreadContext<T> getCurrentThreadContext(ThreadContext<T> threadContext)
    {
        return ((ThreadContextImpl<T>) threadContext).get();
    }
71937
@Override
    public ThreadContext createDefaultThreadContext(Map<String, String> execProps) {
        String identityName = execProps.get(WSContextService.TASK_OWNER);
        SecurityContext defaultCtx = new SecurityContext() {
            private static final long serialVersionUID = 1924323423421234352L;

            @Override
            public void setupSecurityContext(CallbackHandler arg0, Subject arg1, Subject arg2) {
                // do nothing and instead use the default subjects passed in by the application server.
            }
        };
        CredentialsService credService = (CredentialsService) credServiceRef.getServiceWithException();
        WSSecurityService wss = (WSSecurityService) securityServiceRef.getServiceWithException();
        UnauthenticatedSubjectService unauthSubjService = (UnauthenticatedSubjectService) unauthSubjectServiceRef.getServiceWithException();
        AuthenticationService authService = (AuthenticationService) authServiceRef.getServiceWithException();
        return new SecurityInflowContext(credService, wss, unauthSubjService, authService, defaultCtx, identityName);
    }
89541
public AuditMessageSender getSender()
	{
		if (customSender == null){
	    	String transport = AuditorModuleContext.getContext().getConfig().getAuditRepositoryTransport();
			if (transport.equalsIgnoreCase("TLS") ) {
				return new TLSSyslogSenderImpl();
			} else if (transport.equalsIgnoreCase("UDP") ){
				return new UDPSyslogSenderImpl();
			} else {
				return new BSDSyslogSenderImpl();
			}
		}else
			return customSender;
	}
1093975
private Context currentContext()
   {
      LinkedList<Context> stack = threadContexts.get();

      if (stack != null && !stack.isEmpty())
      {
         return stack.getLast();
      }

      return null;
   }
92593
public static String getFlowContext() {
    TransactionLogger instance = getInstance();
    if (instance == null) {
      return null;
    }

    return instance.flowContext;
  }