Java Timer Usage stopPrintStackTraces()

Here you can find the source of stopPrintStackTraces()

Description

Stop any scheduled stack dumps

License

Open Source License

Declaration

public static void stopPrintStackTraces() 

Method Source Code

//package com.java2s;
/*******************************************************************************
 *  Copyright (c) 2012 Google, Inc./* w  ww  . j  a  v  a2  s. c  o m*/
 *  All rights reserved. This program and the accompanying materials
 *  are made available under the terms of the Eclipse Public License v1.0
 *  which accompanies this distribution, and is available at
 *  http://www.eclipse.org/legal/epl-v10.html
 *  
 *  Contributors:
 *  Google, Inc. - initial API and implementation
 *******************************************************************************/

import java.util.Timer;

public class Main {
    private static final Object LOCK = new Object();
    private static Timer timer;

    /**
     * Stop any scheduled stack dumps
     */
    public static void stopPrintStackTraces() {
        synchronized (LOCK) {
            if (timer != null) {
                timer.cancel();
                timer = null;
            }
        }
    }
}

Related

  1. runRotateKeys()
  2. schedule(final TimerTask task, final int delay, final int period)
  3. schedule(TimerTask task, long delay, long period, String name)
  4. startTimerWithDelayInMillis(TimerTask task, long millisToDelay, long intervalInMillis)
  5. stop(final TimerTask task)
  6. timerTask(Runnable runnable)