public static void setShardingVo(ShardingVO shardingVo){ contextHolder.set(shardingVo); }
/** * Binds the specified stream to the current thread. * * @param output * the stream to bind * @return the OutputStream that was previously active */ public OutputStream bindStream(final OutputStream output) { final OutputStream stream = outputStreamThreadLocal.get(); outputStreamThreadLocal.set(output); return stream; }
/** * Bind the specified stream to the current thread. * * @param input the stream to bind * @return the InputStream that was previously active */ public InputStream bindStream( final InputStream input ) { final InputStream oldValue = m_streams.get(); m_streams.set( input ); return oldValue; }
public static void setThreadAttemptId(String attemptId) { assert attemptId != null; threadAttemptId.set(attemptId); }
/** * Register a {@link SharedResourcesBroker} to be used as the implicit broker for this and all new children threads. */ public static void registerImplicitBroker(SharedResourcesBroker<?> broker) { threadLocalBroker.set(broker); }
public static void setThreadAttemptId(String attemptId) { assert attemptId != null; threadAttemptId.set(attemptId); }
/** * Set the analysis cache for the current thread. This should be called * before any detectors or analyses that need the cache are used. * * @param analysisCache * the analysis cache to set for the current thread */ public static void setAnalysisCacheForCurrentThread(IAnalysisCache analysisCache) { analysisCacheThreadLocal.set(analysisCache); }
public void setContextMap(Map<String, String> contextMap) { inheritableThreadLocal.set(new HashMap<String, String>(contextMap)); } }
/** * Set the {@code baseUri} of the actual request into the {@link InheritableThreadLocal}. * <p> * The {@code baseUri} will be used for absolutizing the location header * content in case that only a relative URI is provided. * </p> * <p> * After resource method invocation when the value is not needed * any more to be stored in {@code ThreadLocal} {@link #clearBaseUri() clearBaseUri()} should be * called for cleanup in order to prevent possible memory leaks. * </p> * * @param baseUri - baseUri of the actual request * @see #location(java.net.URI) * @since 2.4 */ public static void setBaseUri(URI baseUri) { baseUriThreadLocal.set(baseUri); }
/** * Set the {@code baseUri} of the actual request into the {@link InheritableThreadLocal}. * <p> * The {@code baseUri} will be used for absolutizing the location header * content in case that only a relative URI is provided. * </p> * <p> * After resource method invocation when the value is not needed * any more to be stored in {@code ThreadLocal} {@link #clearBaseUri() clearBaseUri()} should be * called for cleanup in order to prevent possible memory leaks. * </p> * * @param baseUri - baseUri of the actual request * @see #location(java.net.URI) * @since 2.4 */ public static void setBaseUri(URI baseUri) { baseUriThreadLocal.set(baseUri); }
public void setContextMap(Map<String, String> contextMap) { inheritableThreadLocal.set(new HashMap<String, String>(contextMap)); } }
/** * Put a context value (the <code>val</code> parameter) as identified with * the <code>key</code> parameter into the current thread's context map. * Note that contrary to log4j, the <code>val</code> parameter can be null. * * <p> * If the current thread does not have a context map it is created as a side * effect of this call. * * @throws IllegalArgumentException * in case the "key" parameter is null */ public void put(String key, String val) { if (key == null) { throw new IllegalArgumentException("key cannot be null"); } Map<String, String> map = inheritableThreadLocal.get(); if (map == null) { map = new HashMap<String, String>(); inheritableThreadLocal.set(map); } map.put(key, val); }
/** * @param runnable * The runnable to set. */ public static void setRunnable(RunnableWithExceptions runnable) { runnableInstance.set(runnable); }
/** * Bind the specified stream to the current thread. * * @param output the stream to bind * @return the OutputStream that was previously active */ public OutputStream bindStream( OutputStream output ) { OutputStream stream = getStream(); m_streams.set( output ); return stream; }
/** * Bind the specified stream to the current thread. * * @param input the stream to bind * @return the InputStream that was previously active */ public InputStream bindStream( InputStream input ) { InputStream oldValue = getStream(); m_streams.set( input ); return oldValue; }
public JUnitDetectorAdapter(BugReporter bugReporter) { instance.set(this); }
/** * callback log */ private void callbackLog(List<HandleCallbackParam> callbackParamList, String logContent){ for (HandleCallbackParam callbackParam: callbackParamList) { String logFileName = XxlJobFileAppender.makeLogFileName(new Date(callbackParam.getLogDateTim()), callbackParam.getLogId()); XxlJobFileAppender.contextHolder.set(logFileName); XxlJobLogger.log(logContent); } }
/** * Set the current analysis context for this thread. * * @param analysisContext * the current analysis context for this thread */ public static void setCurrentAnalysisContext(AnalysisContext analysisContext) { currentAnalysisContext.set(analysisContext); if (Global.getAnalysisCache() != null) { currentXFactory.set(new XFactory()); } }
private void doFunctionExecutionThread(Runnable command) { stats.incFunctionExecutionThreads(1); isFunctionExecutionThread.set(Boolean.TRUE); try { ConnectionTable.threadWantsSharedResources(); Connection.makeReaderThread(); runUntilShutdown(command); } finally { ConnectionTable.releaseThreadsSockets(); stats.incFunctionExecutionThreads(-1); } }