<commit_before>package com.alibaba.mtc;

import java.util.Map;
import java.util.TimerTask;

/**
 * {@link MtContextTimerTask} decorate {@link Runnable}, so as to get @{@link MtContext}
 * and transmit it to the time of {@link Runnable} execution, needed when use {@link Runnable} to thread pool.
 * <p/>
 * Use factory method {@link #get(TimerTask)} to create instance.
 * <p/>
 * Use {@link java.util.concurrent.ScheduledThreadPoolExecutor} instead {@link java.util.Timer}
 *
 * @author ding.lid
 * @see java.util.Timer
 * @see TimerTask
 * @since 0.9.0
 */
@Deprecated
public final class MtContextTimerTask extends TimerTask {
    private final Map<String, Object> content;
    private final TimerTask timerTask;

    private MtContextTimerTask(TimerTask timerTask) {
        content = MtContext.getContext().getWithCopy();
        this.timerTask = timerTask;
    }

    /**
     * wrap method {@link TimerTask#run()}.
     */
    @Override
    public void run() {
        MtContext mtContext = MtContext.getContext();
        final Map<String, Object> old = mtContext.get0();
        try {
            mtContext.set0(content);
            timerTask.run();
        } finally {
            mtContext.set0(old); // restore MtContext
        }
    }

    @Override
    public boolean cancel() {
        return timerTask.cancel();
    }

    @Override
    public long scheduledExecutionTime() {
        return timerTask.scheduledExecutionTime();<commit_msg>improve javadoc, remove method scheduledExecutionTime<commit_after>package com.alibaba.mtc;

import java.util.Map;
import java.util.TimerTask;

/**
 * {@link MtContextTimerTask} decorate {@link TimerTask}, so as to get @{@link MtContext}
 * and transmit it to the time of {@link Runnable} execution, needed when use {@link Runnable} to thread pool.
 * <p/>
 * Use factory method {@link #get(TimerTask)} to create instance.
 * <p/>
 * Use {@link java.util.concurrent.ScheduledThreadPoolExecutor} instead {@link java.util.Timer}.
 * <p/>
 * <b>NOTE:</b>
 * The {@link MtContextTimerTask} make the the method {@link TimerTask#scheduledExecutionTime()} of
 * the origin {@link TimerTask} lose effectiveness!
 *
 * @author ding.lid
 * @see java.util.Timer
 * @see TimerTask
 * @since 0.9.1
 */
@Deprecated
public final class MtContextTimerTask extends TimerTask {
    private final Map<String, Object> content;
    private final TimerTask timerTask;

    private MtContextTimerTask(TimerTask timerTask) {
        content = MtContext.getContext().getWithCopy();
        this.timerTask = timerTask;
    }

    /**
     * wrap method {@link TimerTask#run()}.
     */
    @Override
    public void run() {
        MtContext mtContext = MtContext.getContext();
        final Map<String, Object> old = mtContext.get0();
        try {
            mtContext.set0(content);
            timerTask.run();
        } finally {
            mtContext.set0(old); // restore MtContext
        }
    }

    @Override
    public boolean cancel() {
        timerTask.cancel();
        return super.cancel();
{'fraction_non_alphanumeric': 0.1182087586433981, 'fraction_numerical': 0.003951267698386566, 'mean_word_length': 2.9868766404199474, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6198077', 'n_tokens_mistral': 910, 'n_tokens_neox': 863, 'n_words': 250}