Overview of Advanced Java 8 CompletableFuture Features (Part 2)
|
|
- Isaac Singleton
- 5 years ago
- Views:
Transcription
1 Overview of Advanced Java 8 CompletableFuture Features (Part 2) Douglas C. Schmidt d.schmidt@vanderbilt.edu Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA
2 Learning Objectives in this Part of the Lesson Understand advanced features of completable futures, e.g. Factory methods that initiate async functionality Completion stage methods used to chain together actions that perform async result processing & composition Completion stage methods Exception methods Arbitrary-arity methods Factory methods Basic methods 2
3 Completion Stage Methods Chain Actions Together 3
4 Completion Stage Methods Chain Actions Together A completable future can serve as a completion stage for async result processing See docs.oracle.com/javase/8/docs/api/java/util/concurrent/completionstage.html 4
5 Completion Stage Methods Chain Actions Together A completable future can serve as a completion stage for async result processing An action is performed on a completed async call result BigFraction unreduced = BigFraction.valueOf(new BigInteger (" "), new BigInteger (" "), false); // Don t reduce! Supplier<BigFraction> reduce = () -> BigFraction.reduce(unreduced); thenapply() s action is triggered when future from supplyasync() completes CompletableFuture.supplyAsync(reduce).thenApply(BigFraction ::tomixedstring)... 5
6 Completion Stage Methods Chain Actions Together A completable future can serve as a completion stage for async result processing An action is performed on a completed async call result Methods can be chained together fluently BigFraction unreduced = BigFraction.valueOf(new BigInteger (" "), new BigInteger (" "), false); // Don t reduce! Supplier<BigFraction> reduce = () -> BigFraction.reduce(unreduced); thenaccept() s action is triggered when future from thenapply() completes CompletableFuture.supplyAsync(reduce).thenApply(BigFraction ::tomixedstring).thenaccept(system.out::println); See en.wikipedia.org/wiki/fluent_interface 6
7 Completion Stage Methods Chain Actions Together A completable future can serve as a completion stage for async result processing An action is performed on a completed async call result Methods can be chained together fluently Each method registers a lambda action to apply BigFraction unreduced = BigFraction.valueOf(new BigInteger (" "), new BigInteger (" "), false); // Don t reduce! Supplier<BigFraction> reduce = () -> BigFraction.reduce(unreduced); CompletableFuture.supplyAsync(reduce).thenApply(BigFraction ::tomixedstring).thenaccept(system.out::println); 7
8 Completion Stage Methods Chain Actions Together A completable future can serve as a completion stage for async result processing An action is performed on a completed async call result Methods can be chained together fluently Each method registers a lambda action to apply BigFraction unreduced = BigFraction.valueOf(new BigInteger (" "), new BigInteger (" "), false); // Don t reduce! Supplier<BigFraction> reduce = () -> BigFraction.reduce(unreduced); CompletableFuture.supplyAsync(reduce).thenApply(BigFraction ::tomixedstring).thenaccept(system.out::println); Invocation of a lambda action is deferred 8 until previous future completes
9 Completion Stage Methods Chain Actions Together A completable future can serve as a completion stage for async result processing An action is performed on a completed async call result Methods can be chained together fluently Each method registers a lambda action to apply A lambda action is called only after the previous stage completes BigFraction unreduced = BigFraction.valueOf(new BigInteger (" "), new BigInteger (" "), false); // Don t reduce! Supplier<BigFraction> reduce = () -> BigFraction.reduce(unreduced); CompletableFuture.supplyAsync(reduce).thenApply(BigFraction ::tomixedstring).thenaccept(system.out::println); 9
10 Completion Stage Methods Chain Actions Together A completable future can serve as a completion stage for async result processing An action is performed on a completed async call result Methods can be chained together fluently BigFraction unreduced = BigFraction.valueOf(new BigInteger (" "), new BigInteger (" "), false); // Don t reduce! Supplier<BigFraction> reduce = () -> BigFraction.reduce(unreduced); CompletableFuture.supplyAsync(reduce).thenApply(BigFraction ::tomixedstring).thenaccept(system.out::println); Completion stages avoid blocking a thread 10 until the result must be obtained
11 Completion Stage Methods Chain Actions Together A completable future can serve as a completion stage for async result processing Juggling is a good analogy 11 for completion stages!
12 Grouping CompletableFuture Completion Stage Methods 12
13 Grouping CompletableFuture Completion Stage Methods Completion stage methods are grouped based on how a stage is triggered by a previous stage Completion stage methods Exception methods Arbitrary-arity methods Factory methods Basic methods See 13
14 Grouping CompletableFuture Completion Stage Methods Completion stage methods are grouped based on how a stage is triggered by a previous stage Completion of a single previous stage Methods Params Returns Behavior thenapply (Async) Function Completable Future with Apply function to result of the Function result previous stage then Compose (Async) then Accept (Async) thenrun (Async) Function Completable Future with Function result directly, not a nested future Consumer Completable Future<Void> Runnable Completable Future<Void> Apply function to result of the previous stage Consumer handles result of previous stage Run action w/out returning value See 14
15 Grouping CompletableFuture Completion Stage Methods Completion stage methods are grouped based on how a stage is triggered by a previous stage Completion of a single previous stage Methods Params Returns Behavior thenapply (Async) Function Completable Future with Apply function to result of the Function result previous stage then Compose (Async) then Accept (Async) thenrun (Async) Function Completable Future with Function result directly, not a nested future Consumer Completable Future<Void> Runnable Completable Future<Void> Apply function to result of the previous stage Consumer handles result of previous stage Run action w/out returning value Async() variants run in common fork-join 15thread (by default, run in same thread)
16 Grouping CompletableFuture Completion Stage Methods Completion stage methods are grouped based on how a stage is triggered by a previous stage Completion of a single previous stage Completion of both of 2 previous stages i.e., an and Methods Params Returns Behavior then Combine Bi Function Completable Future with Bi Apply bifunction to results of both (Async) Function result previous stages then Accept Both (Async) runafter Both (Async) Bi Completable Consumer Future<Void> Runnable Completable Future<Void> BiConsumer handles results of both previous stages Run action when both previous stages complete 16
17 Grouping CompletableFuture Completion Stage Methods Completion stage methods are grouped based on how a stage is triggered by a previous stage Completion of a single previous stage Completion of both of 2 previous stages Completion of either of 2 previous stages i.e., an or Methods Params Returns Behavior applyto Either Function Completable Future with Apply function to results of either (Async) Function result previous stage accept Either (Async) runafter Either (Async) Consumer Completable Future<Void> Runnable Completable Future<Void> Consumer handles results of either previous stage Run action when either previous stage completes 17
18 Key CompletableFuture Completion Stage Methods 18
19 of a single previous stage thenapply() CompletableFuture<U> thenapply (Function<? super T,? extends U> fn) {... } See docs.oracle.com/javase/8/docs/api/java/util/concurrent/completablefuture.html#thenapply 19
20 of a single previous stage thenapply() Applies a function action to the previous stage s result CompletableFuture<U> thenapply (Function<? super T,? extends U> fn) {... } 20
21 of a single previous stage thenapply() Applies a function action to the previous stage s result Returns a future containing the result of the action CompletableFuture<U> thenapply (Function<? super T,? extends U> fn) {... } 21
22 of a single previous stage thenapply() Applies a function action to the previous stage s result Returns a future containing the result of the action Used for a sync action that returns a value, not a future BigFraction unreduced = BigFraction.valueOf(new BigInteger("..."), new BigInteger("..."), false); // Don t reduce! Supplier<BigFraction> reduce = () -> BigFraction.reduce(unreduced); CompletableFuture.supplyAsync(reduce).thenApply(BigFraction ::tomixedstring)... e.g., tomixedstring() returns a string value 22
23 of a single previous stage thenapply() thencompose() CompletableFuture<U> thencompose (Function<? super T,? extends CompletionStage<U>> fn) {... } See docs.oracle.com/javase/8/docs/api/java/util/concurrent/completablefuture.html#thencompose 23
24 of a single previous stage thenapply() thencompose() Applies a function action to the previous stage s result CompletableFuture<U> thencompose (Function<? super T,? extends CompletionStage<U>> fn) {... } 24
25 of a single previous stage thenapply() thencompose() Applies a function action to the previous stage s result Returns a future containing result of the action directly i.e., not a nested future CompletableFuture<U> thencompose (Function<? super T,? extends CompletionStage<U>> fn) {... } 25
26 of a single previous stage thenapply() thencompose() Applies a function action to the previous stage s result Returns a future containing result of the action directly i.e., not a nested future CompletableFuture<U> thencompose (Function<? super T,? extends CompletionStage<U>> fn) {... } + = + thencompose() is similar to flatmap() 26 on a Stream or Optional
27 of a single previous stage thenapply() thencompose() Applies a function action to the previous stage s result Returns a future containing result of the action directly Used for an async action that returns a completable future Function<BF, CompletableFuture<BF>> reduceandmultiplyfractions = unreduced -> CompletableFuture.supplyAsync (() -> BF.reduce(unreduced)).thenCompose (reduced -> CompletableFuture.supplyAsync(() -> reduced.multiply(...)));... e.g., supplyasync() returns a completable future 27
28 of a single previous stage thenapply() Unwieldy! thencompose() Applies a function action to the previous stage s result Returns a future containing result of the action directly Used for an async action that returns a completable future Avoids unwieldy nesting of futures à la thenapply() Function<BF, CompletableFuture< CompletableFuture<BF>>> reduceandmultiplyfractions = unreduced -> CompletableFuture.supplyAsync (() -> BF.reduce(unreduced)).thenApply (reduced -> CompletableFuture.supplyAsync(() -> reduced.multiply(...)));
29 of a single previous stage thenapply() thencompose() Applies a function action to the previous stage s result Returns a future containing result of the action directly Used for an async action that returns a completable future Avoids unwieldy nesting of futures à la thenapply() CompletableFuture<Integer> countf =.CompletableFuture.supplyAsync (() -> returncompletablefuture()).thencompose (Function.identity())... supplyasync() will return a CompletableFuture to a CompletableFuture here!! Can be used to avoid calling join() when 29 flattening nested completable futures
30 of a single previous stage thenapply() thencompose() Applies a function action to the previous stage s result Returns a future containing result of the action directly Used for an async action that returns a completable future Avoids unwieldy nesting of futures à la thenapply() CompletableFuture<Integer> countf =.CompletableFuture.supplyAsync (() -> returncompletablefuture()).thencompose (Function.identity())... This idiom flattens the return value to just a CompletableFuture! Can be used to avoid calling join() when 30 flattening nested completable futures
31 of a single previous stage thenapply() thencompose() thenaccept() CompletableFuture<Void> thenaccept (Consumer<? super T> action) {... } See docs.oracle.com/javase/8/docs/api/java/util/concurrent/completablefuture.html#thenaccept 31
32 of a single previous stage thenapply() thencompose() thenaccept() Applies a consumer action to handle previous stage s result CompletableFuture<Void> thenaccept (Consumer<? super T> action) {... } This action behaves as a callback with a side-effect See en.wikipedia.org/wiki/callback_(computer_programming) 32
33 of a single previous stage thenapply() thencompose() thenaccept() Applies a consumer action to handle previous stage s result Returns a future to Void CompletableFuture<Void> thenaccept (Consumer<? super T> action) {... } 33
34 of a single previous stage thenapply() thencompose() thenaccept() Applies a consumer action to handle previous stage s result Returns a future to Void Often used at the end of a chain of completion stages BigFraction unreduced = BigFraction.valueOf(new BigInteger("..."), new BigInteger("..."), false); // Don t reduce! Supplier<BigFraction> reduce = () -> BigFraction.reduce(unreduced); CompletableFuture.supplyAsync(reduce).thenApply(BigFraction ::tomixedstring).thenaccept(system.out::println); thenapply() returns a string future that thenaccept() prints when it completes 34
35 of a single previous stage thenapply() thencompose() thenaccept() Applies a consumer action to handle previous stage s result Returns a future to Void Often used at the end of a chain of completion stages BigFraction unreduced = BigFraction.valueOf(new BigInteger("..."), new BigInteger("..."), false); // Don t reduce! Supplier<BigFraction> reduce = () -> BigFraction.reduce(unreduced); CompletableFuture.supplyAsync(reduce).thenApply(BigFraction ::tomixedstring).thenaccept(system.out::println); println() is a callback that has a side-effect (i.e., printing the mixed string) 35
36 of both of two previous stages thencombine() CompletableFuture<U> thencombine (CompletionStage<? Extends U> other, BiFunction<? super T,? super U,? extends V> fn) {... } See docs.oracle.com/javase/8/docs/api/java/util/concurrent/completablefuture.html#thencombine 36
37 of both of two previous stages thencombine() Applies a bifunction action to two previous stages results CompletableFuture<U> thencombine (CompletionStage<? Extends U> other, BiFunction<? super T,? super U,? extends V> fn) {... } 37
38 of both of two previous stages thencombine() Applies a bifunction action to two previous stages results Returns a future containing the result of the action CompletableFuture<U> thencombine (CompletionStage<? Extends U> other, BiFunction<? super T,? super U,? extends V> fn) {... } 38
39 of both of two previous stages thencombine() Applies a bifunction action to two previous stages results Returns a future containing the result of the action CompletableFuture<U> thencombine (CompletionStage<? Extends U> other, BiFunction<? super T,? super U,? extends V> fn) {... } thencombine() essentially 39 performs a reduction
40 of both of two previous stages thencombine() Applies a bifunction action to two previous stages results Returns a future containing the result of the action Used to join two paths of execution thencombine() s action is triggered when its two associated futures complete CompletableFuture<BF> compf1 = CompletableFuture.supplyAsync(() -> /* multiply two BFs. */); CompletableFuture<BF> compf2 = CompletableFuture.supplyAsync(() -> /* divide two BFs. */); compf1.thencombine(compf2, BigFraction::add).thenAccept(System.out::println); 40
41 of either of two previous stages accepteither() CompletableFuture<Void> accepteither (CompletionStage<? Extends T> other, Consumer<? super T> action) {... } See docs.oracle.com/javase/8/docs/api/java/util/concurrent/completablefuture.html#accepteither 41
42 of either of two previous stages accepteither() Applies a consumer action that handles either of the previous stage s results CompletableFuture<Void> accepteither (CompletionStage<? Extends T> other, Consumer<? super T> action) {... } 42
43 of either of two previous stages accepteither() Applies a consumer action that handles either of the previous stage s results Returns a future to Void CompletableFuture<Void> accepteither (CompletionStage<? Extends T> other, Consumer<? super T> action) {... } 43
44 of either of two previous stages accepteither() Applies a consumer action that handles either of the previous stage s results Returns a future to Void Often used at the end of a chain of completion stages Printout sorted results from which ever sorting routine finished first CompletableFuture<List<BigFraction>> quicksort = CompletableFuture.supplyAsync(() -> quicksort(list)); CompletableFuture<List<BigFraction>> mergesort = CompletableFuture.supplyAsync(() -> mergesort(list)); quicksort.accepteither (mergesort, results -> results.foreach(fraction -> System.out.println (fraction.tomixedstring()))); 44
45 End of Overview of Advanced Java 8 Completable Future Features (Part 2) 45
Overview of Advanced Java 8 CompletableFuture Features (Part 3)
Overview of Advanced Java 8 CompletableFuture Features (Part 3) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated
More informationAsynchronous API with CompletableFuture
Asynchronous API with CompletableFuture Performance Tips and Tricks Sergey Kuksenko Java Platform Group, Oracle November, 2017 Safe Harbor Statement The following is intended to outline our general product
More informationAsynchronous API with CompletableFuture
Asynchronous API with CompletableFuture Performance Tips and Tricks Sergey Kuksenko Java Platform Group, Oracle October, 2017 Safe Harbor Statement The following is intended to outline our general product
More informationCPL 2016, week 6. Asynchronous execution. Oleg Batrashev. March 14, Institute of Computer Science, Tartu, Estonia
CPL 2016, week 6 Asynchronous execution Oleg Batrashev Institute of Computer Science, Tartu, Estonia March 14, 2016 Overview Studied so far: 1. Inter-thread visibility: JMM 2. Inter-thread synchronization:
More informationUsing Java CompletionStage in Asynchronous Programming
Using Java CompletionStage in Asynchronous Programming DEV4798 Douglas Surber Oracle Database JDBC Architect Database Server Technologies October 25, 2018 Safe Harbor Statement The following is intended
More informationJava 8 Parallel ImageStreamGang Example (Part 3)
Java 8 Parallel ImageStreamGang Example (Part 3) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt
More informationOverview of Java 8 Parallel Streams (Part 1)
Overview of Java 8 Parallel s (Part 1) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University
More informationThe Java ExecutorService (Part 1)
The Java ExecutorService (Part 1) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Learning
More informationCompletable Future. Srinivasan Raghavan Senior Member of Technical Staff Java Platform Group
Completable Future Srinivasan Raghavan Senior Member of Technical Staff Java Platform Group Program Agenda 1 2 3 4 java.util.future Introduction Cloud Services Design and the fight for Performance CompletableFuture
More informationJava 8 Parallel Stream Internals (Part 2)
Java 8 Parallel Stream Internals (Part 2) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt
More informationOverview of Java Threads (Part 2)
Overview of Java Threads (Part 2) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Learning
More informationOverview of Java Threads (Part 3)
Overview of Java Threads (Part 3) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Learning
More informationThe Java Executor (Part 1)
The Java Executor (Part 1) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Learning
More informationBenefits of Concurrency in Java & Android: Program Structure
Benefits of Concurrency in Java & Android: Program Structure Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University
More informationOverview of Java 8 Functional Interfaces
Overview of Java 8 Functional Interfaces Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University
More informationOverview of Java s Support for Polymorphism
Overview of Java s Support for Polymorphism Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt
More informationExternal vs. Internal Iteration in Java 8
External vs. Internal Iteration in Java 8 Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt
More informationJava Semaphore (Part 1)
Java Semaphore (Part 1) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Learning Objectives
More informationInfrastructure Middleware (Part 3): Android Runtime Core & Native Libraries
Infrastructure Middleware (Part 3): Android Runtime Core & Native Libraries Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt
More informationJava Barrier Synchronizers: CountDownLatch (Part 1)
Java Barrier Synchronizers: CountDownLatch (Part 1) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville,
More informationInfrastructure Middleware (Part 1): Hardware Abstraction Layer (HAL)
Infrastructure Middleware (Part 1): Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA
More informationJava Barrier Synchronizers: CyclicBarrier (Part 1)
Java Barrier Synchronizers: CyclicBarrier (Part 1) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville,
More informationThe Java FutureTask. Douglas C. Schmidt
The Java FutureTask Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Learning Objectives
More informationJava ReentrantLock (Part 1)
Java ReentrantLock (Part 1) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Learning
More informationIntroduction to Coroutines. Roman Elizarov elizarov at JetBrains
Introduction to Coroutines Roman Elizarov elizarov at JetBrains Asynchronous programming How do we write code that waits for something most of the time? A toy problem Kotlin 1 fun requesttoken(): Token
More information15-853:Algorithms in the Real World. Outline. Parallelism: Lecture 1 Nested parallelism Cost model Parallel techniques and algorithms
:Algorithms in the Real World Parallelism: Lecture 1 Nested parallelism Cost model Parallel techniques and algorithms Page1 Andrew Chien, 2008 2 Outline Concurrency vs. Parallelism Quicksort example Nested
More informationJDBC Next A new asynchronous API for connecting to a database
JDBC Next A new asynchronous API for connecting to a database Douglas Surber Kuassi Mensah JDBC Architect Director, Product Management Database Server Technologies April 18, 2017 Safe Harbor Statement
More informationJava Monitor Objects: Synchronization (Part 1)
Java Monitor Objects: Synchronization (Part 1) Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee,
More informationA Case Study of Gang of Four (GoF) Patterns: Part 3
A Case Study of Gang of Four (GoF) Patterns: Part 3 d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University
More informationAn overview of (a)sync & (non-) blocking
An overview of (a)sync & (non-) blocking or why is my web-server not responding? with funny fonts! Experiment & reproduce https://github.com/antonfagerberg/play-performance sync & blocking code sync &
More informationA Case Study of Gang of Four (GoF) Patterns : Part 7
A Case Study of Gang of Four (GoF) Patterns : Part 7 d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University
More informationOverview of Patterns: Introduction
: Introduction d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Introduction
More informationJava SE 8 Programming
Oracle University Contact Us: +52 1 55 8525 3225 Java SE 8 Programming Duration: 5 Days What you will learn This Java SE 8 Programming training covers the core language features and Application Programming
More informationFinal Concurrency. Oleg October 27, 2014
Final Concurrency Oleg Šelajev @shelajev oleg@zeroturnaround.com October 27, 2014 Feedbacks Task Executors Fork-Join framework Completable Future Agenda 2 HOMEWORK 4 FEEDBACK THREAD LOCAL VARIABLES TASK
More informationLAMBDA EXPRESSIONS AND STREAMS API
Java 8 LAMBDA EXPRESSIONS AND STREAMS API An Introduction Methods As Data 2 @FunctionalInterface public interface Runnable { public abstract void run(); public interface ActionListener extends EventListener
More informationSpring MVC 4.x Spring 5 Web Reactive
Part 1 Spring MVC 4.x Spring 5 Web Reactive Rossen Stoyanchev @rstoya05 Spring MVC 4.3 Reactive programming for Java devs Spring 5 Web Reactive Shortcut Annotations @RequestMapping @GetMapping @PostMapping
More informationJava SE 8 Programming
Java SE 8 Programming Training Calendar Date Training Time Location 16 September 2019 5 Days Bilginç IT Academy 28 October 2019 5 Days Bilginç IT Academy Training Details Training Time : 5 Days Capacity
More informationOverview of Activities
d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA CS 282 Principles of Operating Systems II Systems Programming
More informationJava SE 8 Programming
Oracle University Contact Us: Local: 1800 103 4775 Intl: +91 80 67863102 Java SE 8 Programming Duration: 5 Days What you will learn This Java SE 8 Programming training covers the core language features
More informationO futuro chegou: Programação concorrente com futures LEONARDO BORGES SENIOR CLOJURE
O futuro chegou: Programação concorrente com futures LEONARDO BORGES SENIOR CLOJURE ENGINEER @LEONARDO_BORGES SOBRE Um pouco sobre mim Senior Clojure Engineer na Atlassian, Sydney Fundador do Grupo de
More informationOverview of Frameworks: Part 3
: Part 3 d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA CS 282 Principles of Operating Systems II Systems
More informationADBA Asynchronous Database Access
ADBA Asynchronous Database Access A new asynchronous API for connecting to a database Douglas Surber Kuassi Mensah JDBC Architect Director, Product Management Database Server Technologies July 18, 2018
More informationReaktive Anwendungen mit RxJava. Dr. Michael Menzel
Reaktive Anwendungen mit RxJava Dr. Michael Menzel DIGITALIZATION DIGITALIZATION DIGITALIZATION DIGITALIZATION REACTIVE ARCHITECTURES How can we build highly interactive (responsive) systems, which are
More informationTechniques for Dynamic Swapping in the Lightweight CORBA Component Model
in the Lightweight CORBA Component Model jai@dre.vanderbilt.edu www.dre.vanderbilt.edu/~jai Dr. Aniruddha Gokhale gokhale@dre.vanderbilt.edu www.dre.vanderbilt.edu/~gokhale Dr. Douglas C. Schmidt schmidt@dre.vanderbilt.edu
More informationCS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, Name:
CS-140 Fall 2017 Test 1 Version Practice Practice for Nov. 20, 2017 Name: 1. (10 points) For the following, Check T if the statement is true, the F if the statement is false. (a) T F : If a child overrides
More informationAndroid Services & Local IPC: Overview of Programming Bound Services
: Overview of Programming Bound Services d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville,
More informationCSC 301H, Introduction to Software Engineering
CSC 301H, Introduction to Software Engineering Presented by Soheil Hassas Yeganeh Slides By Golnaz Elahi Outline Design Pattern Concept Types of Design Patterns Overview of some Patterns: Abstract Factory
More informationOverview of Layered Architectures
Overview of ed Architectures Douglas C. Schmidt d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville,
More informationBIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic
BIT 3383 Java Programming Sem 1 Session 2011/12 Chapter 2 JAVA basic Objective: After this lesson, you should be able to: declare, initialize and use variables according to Java programming language guidelines
More informationIntroduction to Programming (Java) 4/12
Introduction to Programming (Java) 4/12 Michal Krátký Department of Computer Science Technical University of Ostrava Introduction to Programming (Java) 2008/2009 c 2006 2008 Michal Krátký Introduction
More informationCOMP 322: Fundamentals of Parallel Programming
COMP 322: Fundamentals of Parallel Programming https://wiki.rice.edu/confluence/display/parprog/comp322 Lecture 28: Java Threads (contd), synchronized statement Vivek Sarkar Department of Computer Science
More informationState Machine Diagrams
State Machine Diagrams Introduction A state machine diagram, models the dynamic aspects of the system by showing the flow of control from state to state for a particular class. 2 Introduction Whereas an
More informationAsynchronous OSGi: Promises for the masses. Tim Ward.
Asynchronous OSGi: Promises for the masses Tim Ward http://www.paremus.com info@paremus.com Who is Tim Ward? @TimothyWard Senior Consulting Engineer, Trainer and Architect at Paremus 5 years at IBM developing
More informationStreams in Java 8. Start programming in a more functional style
Streams in Java 8 Start programming in a more functional style Background Who am I? Tobias Coetzee I m a Technical Lead at BBD I present the Java Expert Level Certifications at BBD (EJB, JPA, etc.) I m
More informationJAX-RS and CDI Bike the (ReacIve) Bridge CON2549
JAX-RS and CDI Bike the (ReacIve) Bridge CON2549 David Delabassée (@delabassee) - Oracle José Paumard (@josepaumard) - Consultant October, 2017 2 @delabassee 3 @JosePaumard @JosePaumard https://github.com/josepaumard
More informationJava Concurrency For Humans. Cay Horstmann Author of Core Java (10 editions since 1996)
Java Concurrency For Humans Cay Horstmann Author of Core Java (10 editions since 1996) Outline Audience: Application programmers Goal: Modern Concurrency Constructs Executors and Futures Asynchronous Processing
More informationCP122 CS I. Iteration
CP122 CS I Iteration Tech News! Pix2Pix: machine learning translation of images https://affinelayer.com/pixsrv/ Tech News! Pix2Pix: machine learning translation of images https://affinelayer.com/pixsrv/
More informationChapter 12 Supplement: Recursion with Java 1.5. Mr. Dave Clausen La Cañada High School
Chapter 12 Supplement: Recursion with Java 1.5 La Cañada High School Recursion: Definitions Recursion The process of a subprogram (method) calling itself. A clearly defined stopping state must exist. The
More informationS O R T I N G Sorting a list of elements implemented as an array. In all algorithms of this handout the sorting of elements is in ascending order
S O R T I N G Sorting is interpreted as arranging data in some particular order. In this handout we discuss different sorting techniques for a list of elements implemented as an array. In all algorithms
More informationAsync Programming & Networking. CS 475, Spring 2018 Concurrent & Distributed Systems
Async Programming & Networking CS 475, Spring 2018 Concurrent & Distributed Systems Review: Resource Metric Processes images Camera Sends images Image Service 2 Review: Resource Metric Processes images
More informationImprovements to std::future<t> and Related APIs
Document number: Supersedes: Date: Reply-to: N3784 N3721 2013-09-27 Niklas Gustafsson < niklas.gustafsson@microsoft.com> Artur Laksberg < arturl@microsoft.com> Herb Sutter < hsutter@microsoft.com> Sana
More informationLecture 24: Java Threads,Java synchronized statement
COMP 322: Fundamentals of Parallel Programming Lecture 24: Java Threads,Java synchronized statement Zoran Budimlić and Mack Joyner {zoran, mjoyner@rice.edu http://comp322.rice.edu COMP 322 Lecture 24 9
More informationImprovements to std::future<t> and Related APIs
Document number: Supersedes: Date: Reply-to: N3634 N3558 2013-05-02 Niklas Gustafsson < niklas.gustafsson@microsoft.com> Artur Laksberg < arturl@microsoft.com> Herb Sutter < hsutter@microsoft.com> Sana
More informationIntelligent Event Processing in Quality of Service (QoS) Enabled Publish/Subscribe (Pub/Sub) Middleware
Intelligent Event Processing in Quality of Service (QoS) Enabled Publish/Subscribe (Pub/Sub) Middleware Joe Hoffert jhoffert@dre.vanderbilt.edu http://www.dre.vanderbilt.edu/~jhoffert/ CS PhD Student Vanderbilt
More informationJava SE 8 New Features
Java SE 8 New Features Duration 2 Days What you will learn This Java SE 8 New Features training delves into the major changes and enhancements in Oracle Java SE 8. You'll focus on developing an understanding
More informationPython Asynchronous Programming with Salt Stack (tornado, asyncio) and RxPY
Python Asynchronous Programming with Salt Stack (tornado, asyncio) and RxPY PyCon Korea 2017 Kim Sol kstreee@gmail.com Python Asynchronous Programming with Salt Stack (tornado, asyncio) and RxPY Kim Sol
More informationAndroid Services & Local IPC: The Command Processor Pattern (Part 1)
: The Command Processor Pattern (Part 1) d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville,
More informationCloud Ready: Introduction to Distributed Lambdas
Cloud Ready: Introduction to Distributed Lambdas Brian Oliver Architect Java Specification Lead Oracle Cloud Engineering April 2017 Email: brian.oliver@oracle.com Twitter: @pinocchiocode Safe Harbor Statement
More informationReactive Programming in Java. Copyright - Syncogni Consulting Pvt Ltd. All rights reserved.
Reactive Programming in Java Copyright - Syncogni Consulting Pvt Ltd. All rights reserved. Prerequisites: Functional Programming as in Java 8 Streams of Java 8 Lambda expressions Method references Expectations
More informationINSTRUCTIONS TO CANDIDATES
NATIONAL UNIVERSITY OF SINGAPORE SCHOOL OF COMPUTING FINAL ASSESSMENT FOR Semester 1 AY2017/2018 CS2030 Programming Methodology II November 2017 Time Allowed 2 Hours INSTRUCTIONS TO CANDIDATES 1. This
More informationTurbo Charge CPU Utilization in Fork/Join Using the ManagedBlocker
1 Turbo Charge CPU Utilization in Fork/Join Using the ManagedBlocker 2017 Heinz Kabutz, All Rights Reserved Dr Heinz M. Kabutz Last Updated 2017-01-24 2 Regular 3 ManagedBlocker 4 Speeding Up Fibonacci
More informationParallel Programming Patterns Overview CS 472 Concurrent & Parallel Programming University of Evansville
Parallel Programming Patterns Overview CS 472 Concurrent & Parallel Programming of Evansville Selection of slides from CIS 410/510 Introduction to Parallel Computing Department of Computer and Information
More information3. Java - Language Constructs I
Names and Identifiers A program (that is, a class) needs a name public class SudokuSolver {... 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations,
More informationCS111: PROGRAMMING LANGUAGE II
CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 1(c): Java Basics (II) Lecture Contents Java basics (part II) Conditions Loops Methods Conditions & Branching Conditional Statements A
More informationCOMP6700/2140 Code as Data
COMP6700/2140 Code as Data Alexei B Khorev Research School of Computer Science, ANU March 2017 Alexei B Khorev (RSCS, ANU) COMP6700/2140 Code as Data March 2017 1 / 19 Topics 1 What does treating code
More informationFunctional Programming. Pure Functional Programming
Functional Programming Pure Functional Programming Computation is largely performed by applying functions to values. The value of an expression depends only on the values of its sub-expressions (if any).
More informationFresh Async With Kotlin. Presented at QCon SF, 2017 /Roman JetBrains
Fresh Async With Kotlin Presented at QCon SF, 2017 /Roman Elizarov @ JetBrains Speaker: Roman Elizarov 16+ years experience Previously developed high-perf trading software @ Devexperts Teach concurrent
More informationCourses For Event Java Advanced Summer Training 2018
Courses For Event Java Advanced Summer Training 2018 Java Fundamentals Oracle Java SE 8 Advanced Java Training Java Advanced Expert Edition Topics For Java Fundamentals Variables Data Types Operators Part
More informationPATTERN-ORIENTED SOFTWARE ARCHITECTURE
PATTERN-ORIENTED SOFTWARE ARCHITECTURE A Pattern Language for Distributed Computing Volume 4 Frank Buschmann, Siemens, Munich, Germany Kevlin Henney, Curbralan, Bristol, UK Douglas C. Schmidt, Vanderbilt
More informationLambda Expressions and Java 8 Streams. Jan Trienes, adapted by Th. Dorssers, Pieter van den Hombergh. Contents of this talk.
Java 8 s and Java 8 van den Hombergh Fontys Hogeschool voor Techniek en Logistiek February 23, 2017 and /FHTenL s and Java 8 February 23, 2017 1/28 talk Expression and Internal/External Iteration Java
More informationFree your Lambdas Java SE 8
Free your Lambdas Java SE 8 Agenda Tutorial session: we will start at the very beginning! and explore how to build functional interfaces to design new APIs This is about lambdas and functional interfaces
More informationA Standardized Representation of Asynchronous Operations
Document number: Supersedes: Date: Reply-to: N3558 N3428=12-0118 March 15 th 2013 Niklas Gustafsson < niklas.gustafsson@microsoft.com> Artur Laksberg < arturl@microsoft.com> Herb Sutter < hsutter@microsoft.com>
More informationJava8: Stream Style. Sergey
Java8: Stream Style Sergey Kuksenko sergey.kuksenko@oracle.com, @kuksenk0 The following is intended to outline our general product direction. It is intended for information purposes only, and may not be
More informationParadigmas de Computação Paralela
Paradigmas de Computação Paralela Concurrent/Parallel Programming in OO /Java João Luís Ferreira Sobral jls@... Specification of concurrency/parallelism Benefits from concurrent programming Programs that
More informationReactive Programming in Java. Copyright - Syncogni Consulting Pvt Ltd. All rights reserved.
Reactive Programming in Java Copyright - Syncogni Consulting Pvt Ltd. All rights reserved. Prerequisites: Core Java Lambda Expressions Method references Functional Programming Web - application development
More informationCS-140 Fall 2018 Test 2 Version A Nov. 12, Name:
CS-140 Fall 2018 Test 2 Version A Nov. 12, 2018 Name: 1. (10 points) For the following, Check T if the statement is true, or F if the statement is false. (a) X T F : A class in Java contains fields, and
More informationCSE 143 Sp03 Final Exam Sample Solution Page 1 of 13
CSE 143 Sp03 Final Exam Sample Solution Page 1 of 13 Question 1. (3 points) Java classifies exceptions as either checked or unchecked. For each of the following, indicate whether it is checked or unchecked
More informationMulticore Programming
Multicore Programming Java Streams Louis-Claude Canon louis-claude.canon@univ-fcomte.fr Bureau 414C Master 1 informatique Semestre 8 Louis-Claude Canon MCP Java Streams 1 / 124 Motivations Express simple
More informationOverview of Patterns
d.schmidt@vanderbilt.edu www.dre.vanderbilt.edu/~schmidt Professor of Computer Science Institute for Software Integrated Systems Vanderbilt University Nashville, Tennessee, USA Topics Covered in this Module
More informationAlgorithmic Analysis. Go go Big O(h)!
Algorithmic Analysis Go go Big O(h)! 1 Corresponding Book Sections Pearson: Chapter 6, Sections 1-3 Data Structures: 4.1-4.2.5 2 What is an Algorithm? Informally, any well defined computational procedure
More informationProcesses, Threads and Processors
1 Processes, Threads and Processors Processes and Threads From Processes to Threads Don Porter Portions courtesy Emmett Witchel Hardware can execute N instruction streams at once Ø Uniprocessor, N==1 Ø
More informationFall 2018 Discussion 8: October 24, 2018 Solutions. 1 Introduction. 2 Primitives
CS 6A Scheme Fall 208 Discussion 8: October 24, 208 Solutions Introduction In the next part of the course, we will be working with the Scheme programming language. In addition to learning how to write
More informationA Standard Programmatic Interface for Asynchronous Operations
Doc No: N3327=12-0017 Date: 2012-01-12 Project: JTC1.22.32 Reply to: Niklas Gustafsson Artur Laksberg Microsoft Corp. 1 Microsoft Way Redmond WA USA 98052-6399 Fax: +1-928-438-4456 Email: niklas.gustafsson@microsoft.com
More informationChapter 17: Sorting Algorithms. 1.1 Description Performance Example: Bubble Sort Bubble Sort Algorithm 5
Chapter 17: Sorting Algorithms Christian Jacob 1 Bubble Sort 3 1.1 Description 3 1.2 Performance 3 1.3 Example: Bubble Sort 4 1.4 Bubble Sort Algorithm 5 2 Selection Sort 6 2.1 Description 6 2.2 Performance
More informationIntroduction to JAVA
Java A001 Hello World Let's study the entire program below: Introduction to JAVA // The "A001" class. import java.awt.*; public class A001 { public static void main (String[] args) { System.out.println("Hello
More informationModule 10: Open Multi-Processing Lecture 19: What is Parallelization? The Lecture Contains: What is Parallelization? Perfectly Load-Balanced Program
The Lecture Contains: What is Parallelization? Perfectly Load-Balanced Program Amdahl's Law About Data What is Data Race? Overview to OpenMP Components of OpenMP OpenMP Programming Model OpenMP Directives
More informationCS 171: Introduction to Computer Science II. Quicksort
CS 171: Introduction to Computer Science II Quicksort Roadmap MergeSort Analysis of Recursive Algorithms QuickSort Algorithm Analysis Practical improvements Java Array.sort() methods Quick Sort Partition
More informationWeeks 6&7: Procedures and Parameter Passing
CS320 Principles of Programming Languages Weeks 6&7: Procedures and Parameter Passing Jingke Li Portland State University Fall 2017 PSU CS320 Fall 17 Weeks 6&7: Procedures and Parameter Passing 1 / 45
More informationΠΙΝΑΚΑΣ ΠΛΑΝΟΥ ΕΚΠΑΙΔΕΥΣΗΣ
ΠΑΡΑΡΤΗΜΑ «Β» ΠΙΝΑΚΑΣ ΠΛΑΝΟΥ ΕΚΠΑΙΔΕΥΣΗΣ Α/Α ΠΕΡΙΓΡΑΦΗ ΕΚΠΑΙΔΕΥΣΗΣ ΘΕΜΑΤΙΚΕΣ ΕΝΟΤΗΤΕΣ 1. Java SE8 Fundamentals What Is a Java Program? Introduction to Computer Programs Key Features of the Java Language
More informationINF 212 ANALYSIS OF PROG. LANGS FUNCTION COMPOSITION. Instructors: Crista Lopes Copyright Instructors.
INF 212 ANALYSIS OF PROG. LANGS FUNCTION COMPOSITION Instructors: Crista Lopes Copyright Instructors. Topics Recursion Higher-order functions Continuation-Passing Style Monads (take 1) Identity Monad Maybe
More information