Skip to content

Instantly share code, notes, and snippets.

@Vzor-
Created August 9, 2019 20:47
Show Gist options
  • Save Vzor-/e44772ce7233e78abe6699919df1e5b4 to your computer and use it in GitHub Desktop.
Save Vzor-/e44772ce7233e78abe6699919df1e5b4 to your computer and use it in GitHub Desktop.
LookupServiceTest
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