Difference between revisions of "Threads and Executors"

From CSE231 Wiki
Jump to navigation Jump to search
Line 3: Line 3:
 
implement <code>Thread newThread(Runnable target)</code>
 
implement <code>Thread newThread(Runnable target)</code>
  
Create and return a [https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#Thread-java.lang.Runnable- new thread with the Runnable parameter] you are passed.
+
Create and return a [https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#Thread-java.lang.Runnable- new thread with the target Runnable parameter] you are passed.
  
 
Do *NOT* [https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#start-- start] this thread.   
 
Do *NOT* [https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#start-- start] this thread.   
Line 9: Line 9:
 
Certainly, do *NOT* [https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#run-- run] this thread.
 
Certainly, do *NOT* [https://docs.oracle.com/javase/8/docs/api/java/lang/Thread.html#run-- run] this thread.
  
[https://en.wikipedia.org/wiki/Do_not_pass_Go._Do_not_collect_$200. Do not pass go.  Do not collect $200.]
+
[https://en.wikipedia.org/wiki/Do_not_pass_Go._Do_not_collect_$200. Do not pass Go.  Do not collect $200.]
 +
 
 +
To repeat: just create a new Thread with the target Runnable and return it.
  
 
==TAgeSum==
 
==TAgeSum==

Revision as of 21:36, 24 September 2017

Threads

class SimpleThreadFactory

implement Thread newThread(Runnable target)

Create and return a new thread with the target Runnable parameter you are passed.

Do *NOT* start this thread.

Certainly, do *NOT* run this thread.

Do not pass Go. Do not collect $200.

To repeat: just create a new Thread with the target Runnable and return it.

TAgeSum

implement int sumUpperLowerSplit(int[] ages, ThreadFactory threadFactory)

Executors

XNucleobaseCount

XQuicksort