List of usage examples for java.lang.reflect AnnotatedType getType
public Type getType();
From source file:org.janusgraph.TestBed.java
/** * @param args// ww w .j a va2s . com * @throws java.io.IOException */ public static void main(String[] args) throws Exception { Method method = TestBed.class.getMethod("getInt", int.class, int.class); AnnotatedType rt = method.getAnnotatedReturnType(); System.out.println(rt.getType()); System.out.println(rt.getAnnotations().length); System.out.println(method.getAnnotations().length); for (int i = 0; i < method.getAnnotations().length; i++) { System.out.println(method.getAnnotations()[i]); } // String[] s = {"a","b","c","d","e","f","g","h","i","x","u"}; // int len = s.length; // Random random = new Random(); // // Context c = new Context(new ObserverManager(),Observer.NO_OP); // //Warmup // for (int i = 0; i < 1000000000; i++) { // c.observe(s[1],s[2]); // } // long before = System.nanoTime(); // for (int i = 0; i < 1000000000; i++) { // c.observe(s[1],s[2]); // } // long total = System.nanoTime()-before; // System.out.println("Total time: " + total/1000000); System.exit(0); final ScheduledExecutorService exe = new ScheduledThreadPoolExecutor(1, new RejectedExecutionHandler() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor executor) { r.run(); } }); ScheduledFuture future = exe.scheduleWithFixedDelay(new Runnable() { AtomicInteger atomicInt = new AtomicInteger(0); @Override public void run() { try { for (int i = 0; i < 10; i++) { exe.submit(new Runnable() { private final int number = atomicInt.incrementAndGet(); @Override public void run() { try { Thread.sleep(150); } catch (InterruptedException e) { e.printStackTrace(); } System.out.println(number); } }); System.out.println("Submitted: " + i); // doSomethingExpensive(20); } } catch (Exception e) { e.printStackTrace(); } } }, 0, 1, TimeUnit.SECONDS); Thread.sleep(10000); // future.get(1,TimeUnit.SECONDS); System.out.println("Cancel: " + future.cancel(false)); System.out.println("Done: " + future.isDone()); exe.shutdown(); // Thread.sleep(2000); System.out.println("Terminate: " + exe.awaitTermination(5, TimeUnit.SECONDS)); System.out.println("DONE"); NonBlockingHashMapLong<String> id1 = new NonBlockingHashMapLong<String>(128); ConcurrentHashMap<Long, String> id2 = new ConcurrentHashMap<Long, String>(128, 0.75f, 2); }