Created
July 3, 2015 22:52
-
-
Save fmamud/5dbde134e6e957dcfe4d to your computer and use it in GitHub Desktop.
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
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