Last active
October 23, 2018 22:54
-
-
Save harschware/6974b61837618574bae6ab75369ead30 to your computer and use it in GitHub Desktop.
Test NiFi StopWatch class - demonstrates bug at NIFI-5742
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.apache.nifi.util.StopWatch; | |
import java.util.concurrent.TimeUnit; | |
class Scratch { | |
// https://github.com/apache/nifi/blob/02261311b3b3f765ebb394f8f101b0373a7fb3ab/nifi-commons/nifi-utils/src/main/java/org/apache/nifi/util/StopWatch.java#L77 | |
public static void main(String[] args) { | |
StopWatch stopWatch = new StopWatch(true); | |
try { | |
Thread.sleep(250); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
long millsSince = stopWatch.getElapsed(TimeUnit.MILLISECONDS); | |
System.out.println(millsSince); | |
try { | |
Thread.sleep(250); | |
} catch (InterruptedException e) { | |
e.printStackTrace(); | |
} | |
stopWatch.stop(); | |
millsSince = stopWatch.getElapsed(TimeUnit.MILLISECONDS); | |
System.out.println(millsSince); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The test class prints the following: