Simple thread concurrent example source code
2018-02-18
0 0 0
no vote
Other
Earn points
package com;import java.util.concurrent .ExecutorService;import java.util.concurrent .Executors;public class VolatileTest {public static void main(String[] args) throws InterruptedException {final Counter counter = new Counter();ExecutorService threadPool = Executors.newCachedThreadPool ();for (int i = 0; i < 1000; i++) {/*new Thread() {@Overridepublic void run() { counter.inc ();};}.start();*/ threadPool.execute (new Runnable() {@Overridepublic void run() { counter.inc ();}});}// Thread.sleep (3000); System.out.println (counter);}}
Related Source Codes
Android AOA Android Open Accessory Development Usi
0
0
no vote
Golang AOA Android Open Accessory HID Control
0
0
no vote
PClite
0
0
no vote
GMSK Linear Receiver
0
0
no vote
The golden version of AFT that has been passed dow
0
0
no vote
No comment