Skip to content

Instantly share code, notes, and snippets.

@fmamud
Created July 3, 2015 22:52
Show Gist options
  • Save fmamud/5dbde134e6e957dcfe4d to your computer and use it in GitHub Desktop.
Save fmamud/5dbde134e6e957dcfe4d to your computer and use it in GitHub Desktop.
package soujava.threads.java5;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class MainJava5 {
public static void main(String[] args) {
//Executor Framework
ExecutorService pool = Executors.newFixedThreadPool(10);
pool.submit(() -> System.out.println("Hello EF"));
pool.shutdown();
//Concurrent Collections (PriorityBlockingQueue)
//Atomic Variables (AtomicInteger)
AtomicInteger ai = new AtomicInteger();
ai.set(10);
System.out.println(ai.getAndIncrement());
//Synchronizers (CyclicBarrier, CountDownLatch, Exchanger)
//Locks (Lock, ReentrantLock, Condition)
//Nanosecond-granularity timing (System.nanoTime())
System.out.println(System.nanoTime());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment