Traditional Threading Technology Review
Public classTraditionalthread {/** * @paramargs*/ Public Static voidMain (string[] args) {//First type:new thread () thread thread=NewThread () {@Override Public voidrun () { while(true){ Try{Thread.Sleep (500); } Catch(interruptedexception e) {e.printstacktrace (); } System.out.println ("1:" +Thread.CurrentThread (). GetName ()); System.out.println ("2:" + This. GetName ()); } } }; Thread.Start (); Thread thread2=NewThread (NewRunnable () {@Override Public voidrun () { while(true){ Try{Thread.Sleep (500); } Catch(interruptedexception e) {e.printstacktrace (); } System.out.println ("1:" +Thread.CurrentThread (). GetName ()); } } }); Thread2.start (); Second type:new Runnable () NewThread (NewRunnable () { Public voidrun () { while(true){ Try{Thread.Sleep (500); } Catch(interruptedexception e) {e.printstacktrace (); } System.out.println ("Runnable:" +Thread.CurrentThread (). GetName ()); } } } ){ Public voidrun () { while(true){ Try{Thread.Sleep (500); } Catch(interruptedexception e) {e.printstacktrace (); } System.out.println ("Thread:" +Thread.CurrentThread (). GetName ()); }}}.start (); }}
Review of traditional timer technology
Importjava.util.Date;ImportJava.util.Timer;ImportJava.util.TimerTask; Public classTraditionaltimertest {Private Static intCount = 0; Public Static voidMain (string[] args) {/*new Timer (). Schedule (new TimerTask () {@Override public void run () { System.out.println ("bombing!"); }}, 10000,3000);*/ classMytimertaskextendstimertask{@Override Public voidRun () {count= (count+1)%2; System.out.println ("Bombing!"); NewTimer (). Schedule (/*New TimerTask () {@Override public void run () { System.out.println ("bombing!"); } }*/NewMytimertask (), 2000+2000*count); } } NewTimer (). Schedule (NewMytimertask (), 2000); while(true) {System.out.println (NewDate (). getseconds ()); Try{Thread.Sleep (1000); } Catch(interruptedexception e) {//TODO auto-generated Catch blockE.printstacktrace (); } } }}
Traditional thread Mutex technology
Traditional thread synchronous communication technology
Concept and function of shared variables in thread scope
Threadlocal Class and application skills
Discussion on how to share data among multiple threads
Application of Java5 Atomic operation class
Application of Java5 thread concurrency library
The application of callable and future
Thread Lock Technology for JAVA5
The magical technique of java5 reading and writing lock
Application of Java5 condition blocking condition
Java5 's Semaphere Sync Tool
Java5 's Cyclicbarrier Sync Tool
Java5 's Countdownlatch Sync Tool
JAVA5 's Exchanger Sync Tool
Application of Java5 blocking queue
Application of Java5 Synchronous collection class
Aerial network selection Intern's face question 1
Aerial network selection intern's face question 2
Aerial network selection intern's face question 3
How traditional threads are created