Created
August 9, 2019 20:47
-
-
Save Vzor-/e44772ce7233e78abe6699919df1e5b4 to your computer and use it in GitHub Desktop.
LookupServiceTest
This file contains 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 sun.awt.AppContext; | |
import javax.print.PrintServiceLookup; | |
public class Main { | |
public static void main(String[] args) { | |
int count = 0; | |
while (true) { | |
count++; | |
long time1 = System.currentTimeMillis(); | |
//If either line is commented out, the program will run full speed | |
AppContext.getAppContext().put(PrintServiceLookup.class.getDeclaredClasses()[0], null); | |
PrintServiceLookup.lookupPrintServices(null, null); | |
long time2 = System.currentTimeMillis(); | |
System.out.println("Try #" + count + " delta time " + (time2 - time1) + " ms"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment