SlideShare a Scribd company logo
김대우
젬플레이 이사
http://lekdw.blogspot.kr/
정도현(정개발)
나는 프로그래머다 MC
일본 Mamezou소속 컨설턴트
http://Iamprogrammer.io
http://moreagile.net
James Gosling
Patrick Naughton
https://en.wikipedia.org/wiki/Java_(programming_language)
https://en.wikipedia.org/wiki/Java_(programming_language)
J2SE 5.0
Java SE 7
Java SE 8
https://en.wikipedia.org/wiki/Java_version_history
연도별 언어 인기도
http://www.tiobe.com/index.p
hp/content/paperinfo/tpci/ind
ex.html
http://benchmarksgame.alioth.debian.org/u64/which-programs-are-fastest.html
http://www3.ntu.edu.sg/home/ehchua/programming/java/j5b_io.html
http://www.evanjones.ca/software/java-bytebuffers.html
http://netty.io/wiki/using-as-a-generic-library.html
http://terracotta.org/products/bigmemory
모바일 게임 서버와 같이 Life Cycle이 짧은 데이터(객체)를 주로 처리하
는 경우, 별다른 튜닝없이 -server, -d64, -Xms, -Xmx 옵션으로 충분.
http://www.drdobbs.com/jvm/the-comparative-productivity-of-programm/240005881
Language Hours Per Function Point
ASP* 06.1
Visual Basic 08.5
Java 10.6
SQL 10.8
C++ 12.4
C 13.0
C# 15.5
PL/1 14.2
COBOL 16.8
ABAP 19.9
Checkstyle
Error Prone
FindBugs
PMD
SonarQube
http://readwrite.com/2011/01/24/the-java-ecosystem-infographic
JUnit
SLF4J API Module
Scala Library
Logback Classic Module
Guava: Google Core Libraries for Java
Mockito
Google APIs Client Library for Java
Apache Log4j
Commons IO
SLF4J LOG4J-12 Binding
osgi.core
JavaServlet(TM) Specification
TestNG
ScalaTest
Commons Lang
Joda-Time
Spring Context
Mockito
H2 Database Engine
Java Servlet API
http://www.77dev.com/2014/05/java-trends-top-100-mostly-used.html
JCL 1.1.1 implemented over SLF4J
jackson-databind
SLF4J Simple Binding
Apache CommonsCodec
Apache HttpClient
Apache Commons Lang
Commons Logging
Spring Core
osgi.cmpn
Google Guice - Core Library
SpringTestContext Framework
Jetty :: Server Core
Maven Plugin API
FindBugs-jsr305
BeanValidation API
Spring Beans
Groovy
Jackson-core
EasyMock
Spock Framework - Core Module
Java8
http://www.slideshare.net/shintanimoto/from-old-java-to-modern-java
private List m_list=null;
private int process_file(String str_file_name){
String str_line;
List list_lines=new ArrayList();
int i_result=read_file(str_file_name,list_lines);
if(i_result==0){
List list_record=new ArrayList();
for(int i=0;i<list_lines.size();i++){
str_line=(String)list_lines.get(i);
Record record=new Record();
i_result=parse_line(str_line,record);
if(i_result!=0){
return i_result;
}
list_recordord.add(record);
}
m_list=list_record;
return 0;
}else{
return i_result;
}
}
http://www.slideshare.net/shintanimoto/from-old-java-to-modern-java
C-ish java
private List resultList;
private List processFile(String fileName)throws
SystemException {
List lines = readFile(fileName);
List recordList = new ArrayList();
for (int i = 0; i < lines.size(); i++) {
String line = (String) lines.get(i);
Record record = parseLine(line);
recordList.add(record);
}
return recordList;
}
http://www.slideshare.net/shintanimoto/from-old-java-to-modern-java
Java 1.4
private List<Record> processFile(String fileName)throws SystemException {
List<String> lines = readFile(fileName);
List<Record> recordList = new ArrayList();
for (String line : lines) {
Record record = parseLine(line);
recordList.add(record);
}
return recordList;
}
Java 1.7 generic + foreach
private List<String> readFile(String fileName) {
List<String> lines = new ArrayList<String>();
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(fileName));
String line;
while ((line = reader.readLine()) != null) {
lines.add(line);
}
} catch (FileNotFoundException ex) {
throw new SystemException(FILE_NOT_FOUND, ex);
} catch (IOException ex) {
throw new SystemException(FILE_READ_ERROR, ex);
}
finally {
try {
if (reader != null) {
reader.close();
}
} catch (IOException ex) {
// 이건 무시?
}
}
return lines;
}
private List<String> readFile(String fileName) {
List<String> lines = new ArrayList<>();
try (FileReader in = new FileReader(fileName);
BufferedReader reader = new BufferedReader(in)) {
String line;
while ((line = reader.readLine()) != null) {
lines.add(line);
}
} catch (FileNotFoundException ex) {
throw new SystemException(FILE_NOT_FOUND, ex);
} catch (IOException ex) {
throw new SystemException(FILE_READ_ERROR, ex);
}
return lines;
}
Java 7
private List<String> readFile(String fileName) {
try {
return Files.readAllLines(Paths.get(fileName), Charset.defaultCharset());
} catch (IOException ex) {
throw new SystemException(FILE_READ_ERROR, ex);
}
}
Java 7
https://ko.wikipedia.org/wiki/함수형_프로그래
밍
public static <E extends Comparable<? super E>>
List<E> quickSort(List<E> arr) {
if (!arr.isEmpty()) {
E pivot = arr.get(0); //This pivot can change
to get faster results
List<E> less = new LinkedList<E>();
List<E> pivotList = new LinkedList<E>();
List<E> more = new LinkedList<E>();
for (E i: arr) {
if (i.compareTo(pivot) < 0)
less.add(i);
else if (i.compareTo(pivot) > 0)
more.add(i);
else
pivotList.add(i);
}
less = quickSort(less);
more = quickSort(more);
less.addAll(pivotList);
less.addAll(more);
return less;
}
return arr;
}
http://rosettacode.org/wiki/Sorting_algorithms/Quicksort#Java
Java 7
public static <T> List<T> Quicksort(List<T> v, BiFunction<T, T,
Integer> comparer) {
if (v.size() < 2)
return v;
T pivot = v.get(v.size() / 2);
List<T> l = new LinkedList<T>(Quicksort(v.stream()
.filter(x -> comparer.apply(x, pivot) < 0)
.collect(Collectors.toList()), comparer));
l.addAll( v.stream().filter(x -> comparer
.apply(x, pivot) == 0).collect(Collectors.toList()) );
l.addAll( Quicksort(v.stream()
.filter(x -> comparer.apply(x, pivot) > 0)
.collect(Collectors.toList()), comparer) );
return l;
}
Java 8
qsort [] = []
qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ qsort (filter (>= x) xs)
https://en.wikibooks.org/wiki/Algorithm_Implementation/Sorting/Quicksort#Haskell
Haskell
package org.ingini.spark.java8;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.TreeMap;
import static java.util.function.Function.identity;
import static java.util.stream.Collectors.counting;
import static java.util.stream.Collectors.groupingBy;
public class WordsCounterJava {
public static final String REGEX = "s+";
public TreeMap<String, Long> count(String source) throws IOException {
return Files.lines(Paths.get(source))
.map(line -> line.split(REGEX))
.flatMap(Arrays::stream)
.collect(groupingBy(identity(), TreeMap::new, counting()));
}
}
-Djava.util.concurrent.ForkJoinPool.common.parallelism=1
SELECT * FROM BOOK
WHERE BOOK.PUBLISHED_IN = 2011
ORDER BY BOOK.TITLE
jOOQ
create.selectFrom(BOOK)
.where(BOOK.PUBLISHED_IN.eq(2011))
.orderBy(BOOK.TITLE)
http://www.jooq.org/
http://java2practice.com/2014/03/16/java-8-functional-interface-example/
Thread t =new Thread(new Runnable(){
public void run(){
System.out.println("Runnable implemented by using Lambda Expression");
}
});
Thread t = new Thread(()->{
System.out.println("Runnable implemented by using Lambda Expression");
});
Java 7
Java 8
interface DefaultInterfaceTest{
void show();
default void display(){
System.out.println("Default method from interface can have body..!");
}
}
public class DefaultInterfaceTestImpl implements DefaultInterfaceTest{
public void show(){
System.out.println("show method");
}
//we dont need to provide any implementation to default method.
public static void main(String[] args){
DefaultInterfaceTest obj = new DefaultInterfaceTestImpl();
obj.show();//out puts: show method
obj.display();//outputs : Default method from interface can have body..!
}
}
Default Method
•Function <T, R> - T를 입력으로 R을 출력으로 반환
•Predicate <T> - T를 입력으로 boolean을 출력으로 반환
•Consumer <T> - T를 입력으로 아무것도 반환하지 않는다
•Supplier <T> - 입력을 취하지 않고 T를 반환
•BinaryOperator <T> - 2 개의 T를 입력으로 하나의 T를 출력으로
반환
http://www.ibm.com/developerworks/library/j-jvmc2/index.html
Runnable task = () -> {
String threadName = Thread.currentThread().getName();
System.out.println("Hello " + threadName);
};
task.run();
Thread thread = new Thread(task);
thread.start();
ExecutorService executor = Executors.newSingleThreadExecutor();
executor.submit(() -> {
String threadName = Thread.currentThread().getName();
System.out.println("Hello " + threadName);
});
try {
//attempt to shutdown executor
executor.shutdown();
executor.awaitTermination(5, TimeUnit.SECONDS);
}
catch (InterruptedException e) {
System.err.println("tasks interrupted");
}
finally {
if (!executor.isTerminated()) {
executor.shutdownNow();
}
System.out.println("shutdown finished");
}
Executors
http://winterbe.com/posts/2015/04/07/java8-concurrency-tutorial-thread-executor-examples/
http://ariya.ofilabs.com/2014/03/nashorn-the-new-rhino-on-the-block.html
interface CustomerRepository extends Repository<Customer, Long> {
@Query("select c from Customer c")
Stream<Customer> streamAllCustomers();
}
try (Stream<Customer> customers = repository.streamAllCustomers()) {
// use the stream here
}
Support for JDK 8' Stream in repository methods
interface CustomerRepository extends Repository<Customer, Long> {
@Async
CompletableFuture<List<Customer>> readAllBy();
}
CompletableFuture<List<Customer>> future =
repository.readAllBy().thenApply(this::doSomethingWithCustomers);
while (!future.isDone()) {
log.info("Waiting for the CompletableFuture to finish...");
TimeUnit.MILLISECONDS.sleep(500);
}
List<Customer> processedCustomers = future.get();
http://doc.akka.io/docs/akka/2.3.0-RC1/java/lambda-actors.html
import akka.actor.AbstractActor;
import akka.event.Logging;
import akka.event.LoggingAdapter;
import akka.japi.pf.ReceiveBuilder;
import scala.PartialFunction;
import scala.runtime.BoxedUnit;
public class MyActor extends AbstractActor {
private final LoggingAdapter log = Logging.getLogger(context().system(), this);
@Override
public PartialFunction<Object, BoxedUnit> receive() {
return ReceiveBuilder.
match(String.class, s -> s.equals("test"), s -> log.info("received test")).
matchAny(o -> log.info("received unknown message")).build();
}
}
https://blogs.oracle.com/javatraining/entry/announcing_jdk_8_mooc_lambdas
모던자바의 역습
모던자바의 역습
모던자바의 역습
모던자바의 역습
모던자바의 역습
모던자바의 역습
모던자바의 역습
모던자바의 역습
모던자바의 역습
모던자바의 역습
모던자바의 역습
모던자바의 역습

More Related Content

What's hot

Java 8 Feature Preview
Java 8 Feature PreviewJava 8 Feature Preview
Java 8 Feature Preview
Jim Bethancourt
 
Code generation for alternative languages
Code generation for alternative languagesCode generation for alternative languages
Code generation for alternative languages
Rafael Winterhalter
 
Java Concurrency by Example
Java Concurrency by ExampleJava Concurrency by Example
Java Concurrency by Example
Ganesh Samarthyam
 
Functional Thinking - Programming with Lambdas in Java 8
Functional Thinking - Programming with Lambdas in Java 8Functional Thinking - Programming with Lambdas in Java 8
Functional Thinking - Programming with Lambdas in Java 8
Ganesh Samarthyam
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
NexThoughts Technologies
 
Java 8: the good parts!
Java 8: the good parts!Java 8: the good parts!
Java 8: the good parts!
Andrzej Grzesik
 
Sailing with Java 8 Streams
Sailing with Java 8 StreamsSailing with Java 8 Streams
Sailing with Java 8 Streams
Ganesh Samarthyam
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
Ganesh Samarthyam
 
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time APIModern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
Ganesh Samarthyam
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8
Martin Toshev
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeleton
Iram Ramrajkar
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentation
Van Huong
 
Basic Javascript
Basic JavascriptBasic Javascript
Basic Javascript
Bunlong Van
 
Oredev 2015 - Taming Java Agents
Oredev 2015 - Taming Java AgentsOredev 2015 - Taming Java Agents
Oredev 2015 - Taming Java Agents
Anton Arhipov
 
Java SE 8 best practices
Java SE 8 best practicesJava SE 8 best practices
Java SE 8 best practices
Stephen Colebourne
 
Java8 features
Java8 featuresJava8 features
Java8 features
Elias Hasnat
 
Getting started with Java 9 modules
Getting started with Java 9 modulesGetting started with Java 9 modules
Getting started with Java 9 modules
Rafael Winterhalter
 
Voxxed Days Vilnius 2015 - Having fun with Javassist
Voxxed Days Vilnius 2015 - Having fun with JavassistVoxxed Days Vilnius 2015 - Having fun with Javassist
Voxxed Days Vilnius 2015 - Having fun with Javassist
Anton Arhipov
 
Smart Migration to JDK 8
Smart Migration to JDK 8Smart Migration to JDK 8
Smart Migration to JDK 8
Geertjan Wielenga
 

What's hot (20)

Java 8 Feature Preview
Java 8 Feature PreviewJava 8 Feature Preview
Java 8 Feature Preview
 
Code generation for alternative languages
Code generation for alternative languagesCode generation for alternative languages
Code generation for alternative languages
 
Java Concurrency by Example
Java Concurrency by ExampleJava Concurrency by Example
Java Concurrency by Example
 
Functional Thinking - Programming with Lambdas in Java 8
Functional Thinking - Programming with Lambdas in Java 8Functional Thinking - Programming with Lambdas in Java 8
Functional Thinking - Programming with Lambdas in Java 8
 
Java 8 features
Java 8 featuresJava 8 features
Java 8 features
 
Java 8: the good parts!
Java 8: the good parts!Java 8: the good parts!
Java 8: the good parts!
 
Sailing with Java 8 Streams
Sailing with Java 8 StreamsSailing with Java 8 Streams
Sailing with Java 8 Streams
 
Advanced Debugging Using Java Bytecodes
Advanced Debugging Using Java BytecodesAdvanced Debugging Using Java Bytecodes
Advanced Debugging Using Java Bytecodes
 
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time APIModern Programming in Java 8 - Lambdas, Streams and Date Time API
Modern Programming in Java 8 - Lambdas, Streams and Date Time API
 
New Features in JDK 8
New Features in JDK 8New Features in JDK 8
New Features in JDK 8
 
Advance Java Programs skeleton
Advance Java Programs skeletonAdvance Java Programs skeleton
Advance Java Programs skeleton
 
Java 5 and 6 New Features
Java 5 and 6 New FeaturesJava 5 and 6 New Features
Java 5 and 6 New Features
 
Java 8 presentation
Java 8 presentationJava 8 presentation
Java 8 presentation
 
Basic Javascript
Basic JavascriptBasic Javascript
Basic Javascript
 
Oredev 2015 - Taming Java Agents
Oredev 2015 - Taming Java AgentsOredev 2015 - Taming Java Agents
Oredev 2015 - Taming Java Agents
 
Java SE 8 best practices
Java SE 8 best practicesJava SE 8 best practices
Java SE 8 best practices
 
Java8 features
Java8 featuresJava8 features
Java8 features
 
Getting started with Java 9 modules
Getting started with Java 9 modulesGetting started with Java 9 modules
Getting started with Java 9 modules
 
Voxxed Days Vilnius 2015 - Having fun with Javassist
Voxxed Days Vilnius 2015 - Having fun with JavassistVoxxed Days Vilnius 2015 - Having fun with Javassist
Voxxed Days Vilnius 2015 - Having fun with Javassist
 
Smart Migration to JDK 8
Smart Migration to JDK 8Smart Migration to JDK 8
Smart Migration to JDK 8
 

Viewers also liked

Java9 특징 훑어보기
Java9 특징 훑어보기Java9 특징 훑어보기
Java9 특징 훑어보기
duriepark 유현석
 
자바9 특징 (Java9 Features)
자바9 특징 (Java9 Features)자바9 특징 (Java9 Features)
자바9 특징 (Java9 Features)
Chang-Hwan Han
 
java 8 람다식 소개와 의미 고찰
java 8 람다식 소개와 의미 고찰java 8 람다식 소개와 의미 고찰
java 8 람다식 소개와 의미 고찰
Sungchul Park
 
발렌타인 웨비너 7회 - React를 이용한 웹 앱 개발 살펴보기
발렌타인 웨비너 7회 - React를 이용한 웹 앱 개발 살펴보기발렌타인 웨비너 7회 - React를 이용한 웹 앱 개발 살펴보기
발렌타인 웨비너 7회 - React를 이용한 웹 앱 개발 살펴보기
DoHyun Jung
 
우리가 모르는 노드로 할 수 있는 몇가지
우리가 모르는 노드로 할 수 있는 몇가지우리가 모르는 노드로 할 수 있는 몇가지
우리가 모르는 노드로 할 수 있는 몇가지
Rhio Kim
 
SOSCON2015 SI이노베이션
SOSCON2015 SI이노베이션SOSCON2015 SI이노베이션
SOSCON2015 SI이노베이션
DoHyun Jung
 
JavaScript Debugging (수업자료)
JavaScript Debugging (수업자료)JavaScript Debugging (수업자료)
JavaScript Debugging (수업자료)
지수 윤
 
현재 자바스크립트 표준은 어디쯤
현재 자바스크립트 표준은 어디쯤 현재 자바스크립트 표준은 어디쯤
현재 자바스크립트 표준은 어디쯤
Dai-Hyun Lim
 
자바8 나머지 공개
자바8 나머지 공개자바8 나머지 공개
자바8 나머지 공개
Sungchul Park
 
Electron 개발하기
Electron 개발하기Electron 개발하기
Electron 개발하기
성일 한
 
9주 dom & event advanced 실습
9주  dom & event advanced 실습9주  dom & event advanced 실습
9주 dom & event advanced 실습지수 윤
 
VAADIN으로 스크립트 없는 자바 웹 애플리케이션 만들기
VAADIN으로 스크립트 없는 자바 웹 애플리케이션 만들기 VAADIN으로 스크립트 없는 자바 웹 애플리케이션 만들기
VAADIN으로 스크립트 없는 자바 웹 애플리케이션 만들기
Jae-il Lee
 
At Your Service: Using Jenkins in Operations
At Your Service: Using Jenkins in OperationsAt Your Service: Using Jenkins in Operations
At Your Service: Using Jenkins in Operations
Mandi Walls
 
차세대 웹 플랫폼과 HTML5 기술 동향
차세대 웹 플랫폼과 HTML5 기술 동향차세대 웹 플랫폼과 HTML5 기술 동향
차세대 웹 플랫폼과 HTML5 기술 동향
Jonathan Jeon
 
Javascript Test Double Sinon.js
Javascript Test Double Sinon.jsJavascript Test Double Sinon.js
Javascript Test Double Sinon.js
우영 주
 
Akka라이브러리를 이용해 구현하는 결함 내성 (발렌타인 발표자료)
Akka라이브러리를 이용해 구현하는 결함 내성 (발렌타인 발표자료)Akka라이브러리를 이용해 구현하는 결함 내성 (발렌타인 발표자료)
Akka라이브러리를 이용해 구현하는 결함 내성 (발렌타인 발표자료)
DoHyun Jung
 
DDD 준비 서문래
DDD 준비 서문래DDD 준비 서문래
DDD 준비 서문래
beom kyun choi
 
Spring 4.x Web Application 살펴보기
Spring 4.x Web Application  살펴보기Spring 4.x Web Application  살펴보기
Spring 4.x Web Application 살펴보기
Ji Heon Kim
 
비전공자의 자바스크립트 도전기
비전공자의 자바스크립트 도전기비전공자의 자바스크립트 도전기
비전공자의 자바스크립트 도전기
jeong seok yang
 
RESTful Java
RESTful JavaRESTful Java
RESTful Java
JavaCommunity.Org
 

Viewers also liked (20)

Java9 특징 훑어보기
Java9 특징 훑어보기Java9 특징 훑어보기
Java9 특징 훑어보기
 
자바9 특징 (Java9 Features)
자바9 특징 (Java9 Features)자바9 특징 (Java9 Features)
자바9 특징 (Java9 Features)
 
java 8 람다식 소개와 의미 고찰
java 8 람다식 소개와 의미 고찰java 8 람다식 소개와 의미 고찰
java 8 람다식 소개와 의미 고찰
 
발렌타인 웨비너 7회 - React를 이용한 웹 앱 개발 살펴보기
발렌타인 웨비너 7회 - React를 이용한 웹 앱 개발 살펴보기발렌타인 웨비너 7회 - React를 이용한 웹 앱 개발 살펴보기
발렌타인 웨비너 7회 - React를 이용한 웹 앱 개발 살펴보기
 
우리가 모르는 노드로 할 수 있는 몇가지
우리가 모르는 노드로 할 수 있는 몇가지우리가 모르는 노드로 할 수 있는 몇가지
우리가 모르는 노드로 할 수 있는 몇가지
 
SOSCON2015 SI이노베이션
SOSCON2015 SI이노베이션SOSCON2015 SI이노베이션
SOSCON2015 SI이노베이션
 
JavaScript Debugging (수업자료)
JavaScript Debugging (수업자료)JavaScript Debugging (수업자료)
JavaScript Debugging (수업자료)
 
현재 자바스크립트 표준은 어디쯤
현재 자바스크립트 표준은 어디쯤 현재 자바스크립트 표준은 어디쯤
현재 자바스크립트 표준은 어디쯤
 
자바8 나머지 공개
자바8 나머지 공개자바8 나머지 공개
자바8 나머지 공개
 
Electron 개발하기
Electron 개발하기Electron 개발하기
Electron 개발하기
 
9주 dom & event advanced 실습
9주  dom & event advanced 실습9주  dom & event advanced 실습
9주 dom & event advanced 실습
 
VAADIN으로 스크립트 없는 자바 웹 애플리케이션 만들기
VAADIN으로 스크립트 없는 자바 웹 애플리케이션 만들기 VAADIN으로 스크립트 없는 자바 웹 애플리케이션 만들기
VAADIN으로 스크립트 없는 자바 웹 애플리케이션 만들기
 
At Your Service: Using Jenkins in Operations
At Your Service: Using Jenkins in OperationsAt Your Service: Using Jenkins in Operations
At Your Service: Using Jenkins in Operations
 
차세대 웹 플랫폼과 HTML5 기술 동향
차세대 웹 플랫폼과 HTML5 기술 동향차세대 웹 플랫폼과 HTML5 기술 동향
차세대 웹 플랫폼과 HTML5 기술 동향
 
Javascript Test Double Sinon.js
Javascript Test Double Sinon.jsJavascript Test Double Sinon.js
Javascript Test Double Sinon.js
 
Akka라이브러리를 이용해 구현하는 결함 내성 (발렌타인 발표자료)
Akka라이브러리를 이용해 구현하는 결함 내성 (발렌타인 발표자료)Akka라이브러리를 이용해 구현하는 결함 내성 (발렌타인 발표자료)
Akka라이브러리를 이용해 구현하는 결함 내성 (발렌타인 발표자료)
 
DDD 준비 서문래
DDD 준비 서문래DDD 준비 서문래
DDD 준비 서문래
 
Spring 4.x Web Application 살펴보기
Spring 4.x Web Application  살펴보기Spring 4.x Web Application  살펴보기
Spring 4.x Web Application 살펴보기
 
비전공자의 자바스크립트 도전기
비전공자의 자바스크립트 도전기비전공자의 자바스크립트 도전기
비전공자의 자바스크립트 도전기
 
RESTful Java
RESTful JavaRESTful Java
RESTful Java
 

Similar to 모던자바의 역습

201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing
wahyuseptiansyah
 
Java 7 & 8 New Features
Java 7 & 8 New FeaturesJava 7 & 8 New Features
Java 7 & 8 New Features
Leandro Coutinho
 
Server1
Server1Server1
Server1
FahriIrawan3
 
Modern Java Development
Modern Java DevelopmentModern Java Development
Modern Java Development
Angel Conde Manjon
 
A topology of memory leaks on the JVM
A topology of memory leaks on the JVMA topology of memory leaks on the JVM
A topology of memory leaks on the JVM
Rafael Winterhalter
 
DevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaDevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern Java
Henri Tremblay
 
JavaOne 2016 - Learn Lambda and functional programming
JavaOne 2016 - Learn Lambda and functional programmingJavaOne 2016 - Learn Lambda and functional programming
JavaOne 2016 - Learn Lambda and functional programming
Henri Tremblay
 
Xopus Application Framework
Xopus Application FrameworkXopus Application Framework
Xopus Application Framework
Jady Yang
 
JUnit 5
JUnit 5JUnit 5
Pimp My Java LavaJUG
Pimp My Java LavaJUGPimp My Java LavaJUG
Pimp My Java LavaJUG
Daniel Petisme
 
Atlassian Groovy Plugins
Atlassian Groovy PluginsAtlassian Groovy Plugins
Atlassian Groovy Plugins
Paul King
 
Java and SPARQL
Java and SPARQLJava and SPARQL
Java and SPARQL
Raji Ghawi
 
Jersey framework
Jersey frameworkJersey framework
Jersey frameworkknight1128
 
Fighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnitFighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnit
James Fuller
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
Mattias Karlsson
 
Nantes Jug - Java 7
Nantes Jug - Java 7Nantes Jug - Java 7
Nantes Jug - Java 7
Sébastien Prunier
 

Similar to 모던자바의 역습 (20)

201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing201913046 wahyu septiansyah network programing
201913046 wahyu septiansyah network programing
 
Java 7 & 8 New Features
Java 7 & 8 New FeaturesJava 7 & 8 New Features
Java 7 & 8 New Features
 
Server1
Server1Server1
Server1
 
3 j unit
3 j unit3 j unit
3 j unit
 
Modern Java Development
Modern Java DevelopmentModern Java Development
Modern Java Development
 
A topology of memory leaks on the JVM
A topology of memory leaks on the JVMA topology of memory leaks on the JVM
A topology of memory leaks on the JVM
 
DevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaDevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern Java
 
JavaOne 2016 - Learn Lambda and functional programming
JavaOne 2016 - Learn Lambda and functional programmingJavaOne 2016 - Learn Lambda and functional programming
JavaOne 2016 - Learn Lambda and functional programming
 
Xopus Application Framework
Xopus Application FrameworkXopus Application Framework
Xopus Application Framework
 
JUnit 5
JUnit 5JUnit 5
JUnit 5
 
Pimp My Java LavaJUG
Pimp My Java LavaJUGPimp My Java LavaJUG
Pimp My Java LavaJUG
 
Slides
SlidesSlides
Slides
 
Java API, Exceptions and IO
Java API, Exceptions and IOJava API, Exceptions and IO
Java API, Exceptions and IO
 
Atlassian Groovy Plugins
Atlassian Groovy PluginsAtlassian Groovy Plugins
Atlassian Groovy Plugins
 
Java and SPARQL
Java and SPARQLJava and SPARQL
Java and SPARQL
 
Jersey framework
Jersey frameworkJersey framework
Jersey framework
 
Fighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnitFighting Fear-Driven-Development With PHPUnit
Fighting Fear-Driven-Development With PHPUnit
 
My java file
My java fileMy java file
My java file
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
Nantes Jug - Java 7
Nantes Jug - Java 7Nantes Jug - Java 7
Nantes Jug - Java 7
 

Recently uploaded

AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
Google
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
Matt Welsh
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
NYGGS Automation Suite
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Globus
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
Globus
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 

Recently uploaded (20)

AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing SuiteAI Pilot Review: The World’s First Virtual Assistant Marketing Suite
AI Pilot Review: The World’s First Virtual Assistant Marketing Suite
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Large Language Models and the End of Programming
Large Language Models and the End of ProgrammingLarge Language Models and the End of Programming
Large Language Models and the End of Programming
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Enterprise Resource Planning System in Telangana
Enterprise Resource Planning System in TelanganaEnterprise Resource Planning System in Telangana
Enterprise Resource Planning System in Telangana
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data AnalysisProviding Globus Services to Users of JASMIN for Environmental Data Analysis
Providing Globus Services to Users of JASMIN for Environmental Data Analysis
 
Understanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSageUnderstanding Globus Data Transfers with NetSage
Understanding Globus Data Transfers with NetSage
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 

모던자바의 역습

  • 1.
  • 2. 김대우 젬플레이 이사 http://lekdw.blogspot.kr/ 정도현(정개발) 나는 프로그래머다 MC 일본 Mamezou소속 컨설턴트 http://Iamprogrammer.io http://moreagile.net
  • 3.
  • 6. J2SE 5.0 Java SE 7 Java SE 8 https://en.wikipedia.org/wiki/Java_version_history
  • 7.
  • 8.
  • 9.
  • 10.
  • 12.
  • 18. 모바일 게임 서버와 같이 Life Cycle이 짧은 데이터(객체)를 주로 처리하 는 경우, 별다른 튜닝없이 -server, -d64, -Xms, -Xmx 옵션으로 충분.
  • 19.
  • 20.
  • 21.
  • 22. http://www.drdobbs.com/jvm/the-comparative-productivity-of-programm/240005881 Language Hours Per Function Point ASP* 06.1 Visual Basic 08.5 Java 10.6 SQL 10.8 C++ 12.4 C 13.0 C# 15.5 PL/1 14.2 COBOL 16.8 ABAP 19.9
  • 23.
  • 25.
  • 26.
  • 28. JUnit SLF4J API Module Scala Library Logback Classic Module Guava: Google Core Libraries for Java Mockito Google APIs Client Library for Java Apache Log4j Commons IO SLF4J LOG4J-12 Binding osgi.core JavaServlet(TM) Specification TestNG ScalaTest Commons Lang Joda-Time Spring Context Mockito H2 Database Engine Java Servlet API http://www.77dev.com/2014/05/java-trends-top-100-mostly-used.html
  • 29. JCL 1.1.1 implemented over SLF4J jackson-databind SLF4J Simple Binding Apache CommonsCodec Apache HttpClient Apache Commons Lang Commons Logging Spring Core osgi.cmpn Google Guice - Core Library SpringTestContext Framework Jetty :: Server Core Maven Plugin API FindBugs-jsr305 BeanValidation API Spring Beans Groovy Jackson-core EasyMock Spock Framework - Core Module
  • 30.
  • 31. Java8
  • 32.
  • 34. private List m_list=null; private int process_file(String str_file_name){ String str_line; List list_lines=new ArrayList(); int i_result=read_file(str_file_name,list_lines); if(i_result==0){ List list_record=new ArrayList(); for(int i=0;i<list_lines.size();i++){ str_line=(String)list_lines.get(i); Record record=new Record(); i_result=parse_line(str_line,record); if(i_result!=0){ return i_result; } list_recordord.add(record); } m_list=list_record; return 0; }else{ return i_result; } } http://www.slideshare.net/shintanimoto/from-old-java-to-modern-java C-ish java
  • 35. private List resultList; private List processFile(String fileName)throws SystemException { List lines = readFile(fileName); List recordList = new ArrayList(); for (int i = 0; i < lines.size(); i++) { String line = (String) lines.get(i); Record record = parseLine(line); recordList.add(record); } return recordList; } http://www.slideshare.net/shintanimoto/from-old-java-to-modern-java Java 1.4
  • 36. private List<Record> processFile(String fileName)throws SystemException { List<String> lines = readFile(fileName); List<Record> recordList = new ArrayList(); for (String line : lines) { Record record = parseLine(line); recordList.add(record); } return recordList; } Java 1.7 generic + foreach
  • 37.
  • 38. private List<String> readFile(String fileName) { List<String> lines = new ArrayList<String>(); BufferedReader reader = null; try { reader = new BufferedReader(new FileReader(fileName)); String line; while ((line = reader.readLine()) != null) { lines.add(line); } } catch (FileNotFoundException ex) { throw new SystemException(FILE_NOT_FOUND, ex); } catch (IOException ex) { throw new SystemException(FILE_READ_ERROR, ex); } finally { try { if (reader != null) { reader.close(); } } catch (IOException ex) { // 이건 무시? } } return lines; }
  • 39. private List<String> readFile(String fileName) { List<String> lines = new ArrayList<>(); try (FileReader in = new FileReader(fileName); BufferedReader reader = new BufferedReader(in)) { String line; while ((line = reader.readLine()) != null) { lines.add(line); } } catch (FileNotFoundException ex) { throw new SystemException(FILE_NOT_FOUND, ex); } catch (IOException ex) { throw new SystemException(FILE_READ_ERROR, ex); } return lines; } Java 7
  • 40. private List<String> readFile(String fileName) { try { return Files.readAllLines(Paths.get(fileName), Charset.defaultCharset()); } catch (IOException ex) { throw new SystemException(FILE_READ_ERROR, ex); } } Java 7
  • 42.
  • 43. public static <E extends Comparable<? super E>> List<E> quickSort(List<E> arr) { if (!arr.isEmpty()) { E pivot = arr.get(0); //This pivot can change to get faster results List<E> less = new LinkedList<E>(); List<E> pivotList = new LinkedList<E>(); List<E> more = new LinkedList<E>(); for (E i: arr) { if (i.compareTo(pivot) < 0) less.add(i); else if (i.compareTo(pivot) > 0) more.add(i); else pivotList.add(i); } less = quickSort(less); more = quickSort(more); less.addAll(pivotList); less.addAll(more); return less; } return arr; } http://rosettacode.org/wiki/Sorting_algorithms/Quicksort#Java Java 7
  • 44. public static <T> List<T> Quicksort(List<T> v, BiFunction<T, T, Integer> comparer) { if (v.size() < 2) return v; T pivot = v.get(v.size() / 2); List<T> l = new LinkedList<T>(Quicksort(v.stream() .filter(x -> comparer.apply(x, pivot) < 0) .collect(Collectors.toList()), comparer)); l.addAll( v.stream().filter(x -> comparer .apply(x, pivot) == 0).collect(Collectors.toList()) ); l.addAll( Quicksort(v.stream() .filter(x -> comparer.apply(x, pivot) > 0) .collect(Collectors.toList()), comparer) ); return l; } Java 8
  • 45. qsort [] = [] qsort (x:xs) = qsort (filter (< x) xs) ++ [x] ++ qsort (filter (>= x) xs) https://en.wikibooks.org/wiki/Algorithm_Implementation/Sorting/Quicksort#Haskell Haskell
  • 46.
  • 47. package org.ingini.spark.java8; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.Arrays; import java.util.TreeMap; import static java.util.function.Function.identity; import static java.util.stream.Collectors.counting; import static java.util.stream.Collectors.groupingBy; public class WordsCounterJava { public static final String REGEX = "s+"; public TreeMap<String, Long> count(String source) throws IOException { return Files.lines(Paths.get(source)) .map(line -> line.split(REGEX)) .flatMap(Arrays::stream) .collect(groupingBy(identity(), TreeMap::new, counting())); } }
  • 49. SELECT * FROM BOOK WHERE BOOK.PUBLISHED_IN = 2011 ORDER BY BOOK.TITLE jOOQ create.selectFrom(BOOK) .where(BOOK.PUBLISHED_IN.eq(2011)) .orderBy(BOOK.TITLE) http://www.jooq.org/
  • 50.
  • 51. http://java2practice.com/2014/03/16/java-8-functional-interface-example/ Thread t =new Thread(new Runnable(){ public void run(){ System.out.println("Runnable implemented by using Lambda Expression"); } }); Thread t = new Thread(()->{ System.out.println("Runnable implemented by using Lambda Expression"); }); Java 7 Java 8
  • 52. interface DefaultInterfaceTest{ void show(); default void display(){ System.out.println("Default method from interface can have body..!"); } } public class DefaultInterfaceTestImpl implements DefaultInterfaceTest{ public void show(){ System.out.println("show method"); } //we dont need to provide any implementation to default method. public static void main(String[] args){ DefaultInterfaceTest obj = new DefaultInterfaceTestImpl(); obj.show();//out puts: show method obj.display();//outputs : Default method from interface can have body..! } } Default Method
  • 53.
  • 54. •Function <T, R> - T를 입력으로 R을 출력으로 반환 •Predicate <T> - T를 입력으로 boolean을 출력으로 반환 •Consumer <T> - T를 입력으로 아무것도 반환하지 않는다 •Supplier <T> - 입력을 취하지 않고 T를 반환 •BinaryOperator <T> - 2 개의 T를 입력으로 하나의 T를 출력으로 반환
  • 56. Runnable task = () -> { String threadName = Thread.currentThread().getName(); System.out.println("Hello " + threadName); }; task.run(); Thread thread = new Thread(task); thread.start();
  • 57. ExecutorService executor = Executors.newSingleThreadExecutor(); executor.submit(() -> { String threadName = Thread.currentThread().getName(); System.out.println("Hello " + threadName); }); try { //attempt to shutdown executor executor.shutdown(); executor.awaitTermination(5, TimeUnit.SECONDS); } catch (InterruptedException e) { System.err.println("tasks interrupted"); } finally { if (!executor.isTerminated()) { executor.shutdownNow(); } System.out.println("shutdown finished"); } Executors http://winterbe.com/posts/2015/04/07/java8-concurrency-tutorial-thread-executor-examples/
  • 59. interface CustomerRepository extends Repository<Customer, Long> { @Query("select c from Customer c") Stream<Customer> streamAllCustomers(); } try (Stream<Customer> customers = repository.streamAllCustomers()) { // use the stream here } Support for JDK 8' Stream in repository methods
  • 60. interface CustomerRepository extends Repository<Customer, Long> { @Async CompletableFuture<List<Customer>> readAllBy(); } CompletableFuture<List<Customer>> future = repository.readAllBy().thenApply(this::doSomethingWithCustomers); while (!future.isDone()) { log.info("Waiting for the CompletableFuture to finish..."); TimeUnit.MILLISECONDS.sleep(500); } List<Customer> processedCustomers = future.get();
  • 61. http://doc.akka.io/docs/akka/2.3.0-RC1/java/lambda-actors.html import akka.actor.AbstractActor; import akka.event.Logging; import akka.event.LoggingAdapter; import akka.japi.pf.ReceiveBuilder; import scala.PartialFunction; import scala.runtime.BoxedUnit; public class MyActor extends AbstractActor { private final LoggingAdapter log = Logging.getLogger(context().system(), this); @Override public PartialFunction<Object, BoxedUnit> receive() { return ReceiveBuilder. match(String.class, s -> s.equals("test"), s -> log.info("received test")). matchAny(o -> log.info("received unknown message")).build(); } }