com.alibaba.mtc.MtContextTimerTask Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of multithread.context Show documentation
Show all versions of multithread.context Show documentation
a simple lib for transmitting context between thread even using thread pool.
package com.alibaba.mtc;
import java.util.Map;
import java.util.TimerTask;
import java.util.concurrent.atomic.AtomicReference;
/**
* {@link MtContextTimerTask} decorate {@link TimerTask}, so as to get {@link MtContextThreadLocal}
* and transmit it to the time of {@link MtContextTimerTask} execution, needed when use {@link MtContextTimerTask} to {@link java.util.TimerTask}.
*
* Use factory method {@link #get(TimerTask)} to create instance.
*
* NOTE:
* The {@link MtContextTimerTask} make the the method {@link TimerTask#scheduledExecutionTime()} in
* the origin {@link TimerTask} lose effectiveness!
*
* @author ding.lid
* @see java.util.Timer
* @see TimerTask
* @since 0.9.1
* @deprecated Use {@link MtContextRunnable}, {@link java.util.concurrent.ScheduledExecutorService} instead of {@link java.util.Timer}, {@link java.util.TimerTask}.
*/
@Deprecated
public final class MtContextTimerTask extends TimerTask {
private final AtomicReference