SlideShare ist ein Scribd-Unternehmen logo
1 von 25
Downloaden Sie, um offline zu lesen
Java 엿새째
TmaxSoft R&D Center
1
113년	 10월	 22일	 화
자바 교육 계획
1일 : Language, String,
ClassLoader, Proxy
2일 : GC, Collections
3일 : Thread, Java Memory
Model
4일 : AQS, ForkJoin,
Concurrent Utils
5일 : IO, Generics, Annotation,
RMI
6일 : Unsafe, Lambda (Java 8)
2
내겐 바스켓만 보여 (Flow 상태)
213년	 10월	 22일	 화
오늘 내용
sun.misc.Unsafe
Lambda (Java 8)
3
313년	 10월	 22일	 화
sun.misc.Unsafe
4
413년	 10월	 22일	 화
sun.misc.Unsafe
5
A collection of methods for performing low-level, unsafe operations
park, unpark
direct memory manipulation
provide wrappers for malloc, realloc, free, memset, memcpy
(not Java Heap)
direct object memory manipulation
CAS operations : compareAndSwap
defineClass, defineAnonymousClass
513년	 10월	 22일	 화
Java is not safe with Unsafe
6
can easily corrupt memory
fast serialization
super array (non-Java heap)
allocateMemory(long size)
can cause JVM crash
613년	 10월	 22일	 화
Lambda
7
The	
  issue	
  being	
  debated	
  is	
  not	
  whether	
  closures	
  are	
  a	
  
good	
  idea	
  -­‐	
  because	
  they	
  clearly	
  are	
  -­‐	
  but	
  whether	
  
the	
  benefits	
  of	
  retrofi7ng	
  the	
  Java	
  language	
  with	
  
closures	
  are	
  worth	
  the	
  costs.
-­‐	
  Brian	
  Goetz
713년	 10월	 22일	 화
Functional Programming
8
lambda
anonymous function with a single argument
closure
a block of code that may contain free (unbound)
variables
currying
handling multiple argument function with lambda
function
813년	 10월	 22일	 화
Java 8 Lambda Expression
SAM (single abstract method) of an interface
Java lambda expression
a list of formal parameters and a body—an expression
or block—expressed in terms of those parameters
e.g,
s -> s.toUpperCase()
(int a, int b) -> a + b
9
913년	 10월	 22일	 화
Method Reference expression
method reference : refer to a method without invoking it
System::getProperty
"abc"::length
constructor reference : refer to a constructor without creating
a new instance of the named class or array type
ArrayList::new
int[]::new
e.g, Arrays.sort(myIntegerArray, Integer::compare)
10
1013년	 10월	 22일	 화
Java 8 Closure
For both lambda bodies and inner classes, local
variables in the enclosing context can only be
referenced if they are final or effectively final.
A variable is effectively final if it is never assigned to
after its initialization.
11
1113년	 10월	 22일	 화
Java 8 Currying
Currying :A technique of transforming a multi-argument
function in such a way that it can be called as a chain
of functions, each with a single argument.
12
1213년	 10월	 22일	 화
New Object-oriented feature
mixin
a class which contains a combination of methods
from other classes.
can also be viewed as an interface with implemented
methods.
Mixins encourage code reuse and avoid well-known
pathologies associated with multiple inheritance.
13
1313년	 10월	 22일	 화
Java 8 Default Method
Java’s language addition of mixin-like thing
provides a default implementation for any class that
implements the interface without overriding the
method.
allows new functionality to be added to existing (and
perhaps already widely-distributed) interfaces.
More generally, it provides a mechanism for multiple
inheritance of behavior.
14
1413년	 10월	 22일	 화
Java 8 Changes to Interface
Now, interface method can be default, static and
abstract
all the non-default, non-static methods in the
interface are abstract as before
Default methods of super-interface can be accessed
<InterfaceName>.super.<methodName>()
15
1513년	 10월	 22일	 화
Java 8 Project Lambda
Language Changes
Still, No Function Type
Functional Interface
Default Method
Streams
invokeDynamic
java.util.Spliterator
16
1613년	 10월	 22일	 화
Java Lambda ABC
@interface java.lang.FunctionalInterface
Just a hint for compiler (compile error if does not have
SAM)
any interface which has SAM is functional interface
package java.util.function
lambda function does not create additional classes unlike
anonymous inner classes
it creates a private static lambda method
17
1713년	 10월	 22일	 화
Streams
handle aggregate operations DECLARATIVELY
stream pipeline
1 source : collection, array, generator ftn, IO, ...
0 or more intermediate operations : filter, map, ...
1 terminal operation : forEach, reduce, sum, ...
18
1813년	 10월	 22일	 화
Stages of Streams
txns.stream()
.filter(txn -> txn.getBuyer().getAge() >= 65)
.map(txn -> txn.getSeller())
.distinct()
.sort(comparing(seller -> seller.getName()))
.forEach(seller ->
System.out.println(seller.getName());
19
source
intermediate
intermediate
intermediate
intermediate
terminal
intermediate ops just setup pipeline
and returns new stream
1913년	 10월	 22일	 화
Parallel Streams
A stream pipeline can be created with an orientation of either
serial or parallel
Parallelism may be faster but introduces non-determinism
Internally uses fork-join framework
Collection c = ...;
List r1 = c.stream().map(...).collect(toList());
List r2 = c.parallelStream().map(...).collect(toList());
20
2013년	 10월	 22일	 화
Parallel Streams
21
2113년	 10월	 22일	 화
MethodHandle
java.lang.invoke 패키지
can store references to methods in the constant pool, load
with LDC (load constant)
can obtain a method handle for any method (or field access)
But
MethodHandle invocation performance is not good
Lambda is language level method, MethodHandle is VM
level method
22
2213년	 10월	 22일	 화
Lambda Invocation
desugar implementation method
private static boolean lambda$1(int minAge, Person p) { ... }
lambda metafactory에 MethodHandle argument로 전달
invokeDynamic 호출
Predicate $p = invokedynamic[bootstrap=LambdaMetaFactory, ... ]
moving more work from static compiler to runtime
performance
linkage, capture 비용은 inner class보다 싸지만 invoke 비용은 비싸다!
23
2313년	 10월	 22일	 화
invokeDynamic
invokeStatic
System.currentTimeMillis(), Math.log(1.0)
invokeVirtual
"hello".toUpperCase(), System.out.println()
invokeInterface
myList.add("happy happy"), myRunnable.run()
invokeSpecial (constructor or super call)
new ArrayList(), super.equals(other)
성능 비교
invokeStatic (2.7배) >> invokeDynamic (12.6배) >> reflection
24
2413년	 10월	 22일	 화
다음 시간 예정
JEUS Web Engine
25
여러분의 전성시대는 언제였나요?
2513년	 10월	 22일	 화

Weitere ähnliche Inhalte

Was ist angesagt?

Kubernetes #6 advanced scheduling
Kubernetes #6   advanced schedulingKubernetes #6   advanced scheduling
Kubernetes #6 advanced schedulingTerry Cho
 
Kubernetes #2 monitoring
Kubernetes #2   monitoring Kubernetes #2   monitoring
Kubernetes #2 monitoring Terry Cho
 
ARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMS
ARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMSARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMS
ARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMSArun prasath
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with PrometheusShiao-An Yuan
 
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법Open Source Consulting
 
Introduction to Apache Mesos
Introduction to Apache MesosIntroduction to Apache Mesos
Introduction to Apache MesosJoe Stein
 
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기NAVER D2
 
Getting Started Hacking OpenNebula - Fosdem-2013
Getting Started Hacking OpenNebula - Fosdem-2013Getting Started Hacking OpenNebula - Fosdem-2013
Getting Started Hacking OpenNebula - Fosdem-2013OpenNebula Project
 
Orchestration tool roundup - OpenStack Israel summit - kubernetes vs. docker...
Orchestration tool roundup  - OpenStack Israel summit - kubernetes vs. docker...Orchestration tool roundup  - OpenStack Israel summit - kubernetes vs. docker...
Orchestration tool roundup - OpenStack Israel summit - kubernetes vs. docker...Uri Cohen
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeperSaurav Haloi
 
Making Distributed Data Persistent Services Elastic (Without Losing All Your ...
Making Distributed Data Persistent Services Elastic (Without Losing All Your ...Making Distributed Data Persistent Services Elastic (Without Losing All Your ...
Making Distributed Data Persistent Services Elastic (Without Losing All Your ...Joe Stein
 
[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with Prometheus
[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with Prometheus[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with Prometheus
[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with PrometheusOpenStack Korea Community
 
[214]유연하고 확장성 있는 빅데이터 처리
[214]유연하고 확장성 있는 빅데이터 처리[214]유연하고 확장성 있는 빅데이터 처리
[214]유연하고 확장성 있는 빅데이터 처리NAVER D2
 
OSv at Cassandra Summit
OSv at Cassandra SummitOSv at Cassandra Summit
OSv at Cassandra SummitDon Marti
 
Building and deploying a distributed application with Docker, Mesos and Marathon
Building and deploying a distributed application with Docker, Mesos and MarathonBuilding and deploying a distributed application with Docker, Mesos and Marathon
Building and deploying a distributed application with Docker, Mesos and MarathonJulia Mateo
 
Deploying Docker Containers at Scale with Mesos and Marathon
Deploying Docker Containers at Scale with Mesos and MarathonDeploying Docker Containers at Scale with Mesos and Marathon
Deploying Docker Containers at Scale with Mesos and MarathonDiscover Pinterest
 
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021StreamNative
 
Docker volume-isolator-in-mesos
Docker volume-isolator-in-mesosDocker volume-isolator-in-mesos
Docker volume-isolator-in-mesosGuangya Liu
 
On MongoDB backup
On MongoDB backupOn MongoDB backup
On MongoDB backupWilliam Yeh
 

Was ist angesagt? (20)

Kubernetes #6 advanced scheduling
Kubernetes #6   advanced schedulingKubernetes #6   advanced scheduling
Kubernetes #6 advanced scheduling
 
Kubernetes #2 monitoring
Kubernetes #2   monitoring Kubernetes #2   monitoring
Kubernetes #2 monitoring
 
ARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMS
ARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMSARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMS
ARCHITECTING TENANT BASED QOS IN MULTI-TENANT CLOUD PLATFORMS
 
Monitoring with Prometheus
Monitoring with PrometheusMonitoring with Prometheus
Monitoring with Prometheus
 
Apache Mesos
Apache MesosApache Mesos
Apache Mesos
 
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법[오픈소스컨설팅] EFK Stack 소개와 설치 방법
[오픈소스컨설팅] EFK Stack 소개와 설치 방법
 
Introduction to Apache Mesos
Introduction to Apache MesosIntroduction to Apache Mesos
Introduction to Apache Mesos
 
[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기[245] presto 내부구조 파헤치기
[245] presto 내부구조 파헤치기
 
Getting Started Hacking OpenNebula - Fosdem-2013
Getting Started Hacking OpenNebula - Fosdem-2013Getting Started Hacking OpenNebula - Fosdem-2013
Getting Started Hacking OpenNebula - Fosdem-2013
 
Orchestration tool roundup - OpenStack Israel summit - kubernetes vs. docker...
Orchestration tool roundup  - OpenStack Israel summit - kubernetes vs. docker...Orchestration tool roundup  - OpenStack Israel summit - kubernetes vs. docker...
Orchestration tool roundup - OpenStack Israel summit - kubernetes vs. docker...
 
Introduction to Apache ZooKeeper
Introduction to Apache ZooKeeperIntroduction to Apache ZooKeeper
Introduction to Apache ZooKeeper
 
Making Distributed Data Persistent Services Elastic (Without Losing All Your ...
Making Distributed Data Persistent Services Elastic (Without Losing All Your ...Making Distributed Data Persistent Services Elastic (Without Losing All Your ...
Making Distributed Data Persistent Services Elastic (Without Losing All Your ...
 
[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with Prometheus
[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with Prometheus[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with Prometheus
[OpenInfra Days Korea 2018] Day 2 - E6 - OpenInfra monitoring with Prometheus
 
[214]유연하고 확장성 있는 빅데이터 처리
[214]유연하고 확장성 있는 빅데이터 처리[214]유연하고 확장성 있는 빅데이터 처리
[214]유연하고 확장성 있는 빅데이터 처리
 
OSv at Cassandra Summit
OSv at Cassandra SummitOSv at Cassandra Summit
OSv at Cassandra Summit
 
Building and deploying a distributed application with Docker, Mesos and Marathon
Building and deploying a distributed application with Docker, Mesos and MarathonBuilding and deploying a distributed application with Docker, Mesos and Marathon
Building and deploying a distributed application with Docker, Mesos and Marathon
 
Deploying Docker Containers at Scale with Mesos and Marathon
Deploying Docker Containers at Scale with Mesos and MarathonDeploying Docker Containers at Scale with Mesos and Marathon
Deploying Docker Containers at Scale with Mesos and Marathon
 
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021
Distributed Tests on Pulsar with Fallout - Pulsar Summit NA 2021
 
Docker volume-isolator-in-mesos
Docker volume-isolator-in-mesosDocker volume-isolator-in-mesos
Docker volume-isolator-in-mesos
 
On MongoDB backup
On MongoDB backupOn MongoDB backup
On MongoDB backup
 

Ähnlich wie Java 8 고급 (6/6)

Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Martin Odersky
 
Java programing considering performance
Java programing considering performanceJava programing considering performance
Java programing considering performanceRoger Xia
 
whats new in java 8
whats new in java 8 whats new in java 8
whats new in java 8 Dori Waldman
 
Collections and generic class
Collections and generic classCollections and generic class
Collections and generic classifis
 
24 collections framework interview questions
24 collections framework interview questions24 collections framework interview questions
24 collections framework interview questionsArun Vasanth
 
Java Course 4: Exceptions & Collections
Java Course 4: Exceptions & CollectionsJava Course 4: Exceptions & Collections
Java Course 4: Exceptions & CollectionsAnton Keks
 
Clojure - A practical LISP for the JVM
Clojure - A practical LISP for the JVMClojure - A practical LISP for the JVM
Clojure - A practical LISP for the JVMMatthias Nüßler
 
Functional programming with Scala
Functional programming with ScalaFunctional programming with Scala
Functional programming with ScalaNeelkanth Sachdeva
 
Clojure for Java developers
Clojure for Java developersClojure for Java developers
Clojure for Java developersJohn Stevenson
 
JAVA CONCEPTS AND PRACTICES
JAVA CONCEPTS AND PRACTICESJAVA CONCEPTS AND PRACTICES
JAVA CONCEPTS AND PRACTICESNikunj Parekh
 
GJIMT BCA P4UGCA1932U3L6.pptx
GJIMT BCA P4UGCA1932U3L6.pptxGJIMT BCA P4UGCA1932U3L6.pptx
GJIMT BCA P4UGCA1932U3L6.pptxParamjit24
 
Scala overview
Scala overviewScala overview
Scala overviewSteve Min
 

Ähnlich wie Java 8 고급 (6/6) (20)

Java mcq
Java mcqJava mcq
Java mcq
 
Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009Scala Talk at FOSDEM 2009
Scala Talk at FOSDEM 2009
 
Java programing considering performance
Java programing considering performanceJava programing considering performance
Java programing considering performance
 
whats new in java 8
whats new in java 8 whats new in java 8
whats new in java 8
 
Collections and generic class
Collections and generic classCollections and generic class
Collections and generic class
 
24 collections framework interview questions
24 collections framework interview questions24 collections framework interview questions
24 collections framework interview questions
 
Java 8 고급 (4/6)
Java 8 고급 (4/6)Java 8 고급 (4/6)
Java 8 고급 (4/6)
 
Java Course 4: Exceptions & Collections
Java Course 4: Exceptions & CollectionsJava Course 4: Exceptions & Collections
Java Course 4: Exceptions & Collections
 
Clojure - A practical LISP for the JVM
Clojure - A practical LISP for the JVMClojure - A practical LISP for the JVM
Clojure - A practical LISP for the JVM
 
G pars
G parsG pars
G pars
 
Functional programming with Scala
Functional programming with ScalaFunctional programming with Scala
Functional programming with Scala
 
Core_Java_Interview.pdf
Core_Java_Interview.pdfCore_Java_Interview.pdf
Core_Java_Interview.pdf
 
Clojure for Java developers
Clojure for Java developersClojure for Java developers
Clojure for Java developers
 
Javantura v2 - All Together Now - making Groovy and Scala sing together - Din...
Javantura v2 - All Together Now - making Groovy and Scala sing together - Din...Javantura v2 - All Together Now - making Groovy and Scala sing together - Din...
Javantura v2 - All Together Now - making Groovy and Scala sing together - Din...
 
Java interview questions
Java interview questionsJava interview questions
Java interview questions
 
JAVA CONCEPTS AND PRACTICES
JAVA CONCEPTS AND PRACTICESJAVA CONCEPTS AND PRACTICES
JAVA CONCEPTS AND PRACTICES
 
Jist of Java
Jist of JavaJist of Java
Jist of Java
 
Java 10, Java 11 and beyond
Java 10, Java 11 and beyondJava 10, Java 11 and beyond
Java 10, Java 11 and beyond
 
GJIMT BCA P4UGCA1932U3L6.pptx
GJIMT BCA P4UGCA1932U3L6.pptxGJIMT BCA P4UGCA1932U3L6.pptx
GJIMT BCA P4UGCA1932U3L6.pptx
 
Scala overview
Scala overviewScala overview
Scala overview
 

Mehr von Kyung Koo Yoon

Spring Framework - Inversion of Control Container
Spring Framework - Inversion of Control ContainerSpring Framework - Inversion of Control Container
Spring Framework - Inversion of Control ContainerKyung Koo Yoon
 
Smart software engineer
Smart software engineerSmart software engineer
Smart software engineerKyung Koo Yoon
 
Lecture on Java Concurrency Day 3 on Feb 11, 2009.
Lecture on Java Concurrency Day 3 on Feb 11, 2009.Lecture on Java Concurrency Day 3 on Feb 11, 2009.
Lecture on Java Concurrency Day 3 on Feb 11, 2009.Kyung Koo Yoon
 
Lecture on Java Concurrency Day 2 on Feb 4, 2009.
Lecture on Java Concurrency Day 2 on Feb 4, 2009.Lecture on Java Concurrency Day 2 on Feb 4, 2009.
Lecture on Java Concurrency Day 2 on Feb 4, 2009.Kyung Koo Yoon
 
Lecture on Java Concurrency Day 4 on Feb 18, 2009.
Lecture on Java Concurrency Day 4 on Feb 18, 2009.Lecture on Java Concurrency Day 4 on Feb 18, 2009.
Lecture on Java Concurrency Day 4 on Feb 18, 2009.Kyung Koo Yoon
 
Lecture on Java Concurrency Day 1 on Jan 21, 2009.
Lecture on Java Concurrency Day 1 on Jan 21, 2009.Lecture on Java Concurrency Day 1 on Jan 21, 2009.
Lecture on Java Concurrency Day 1 on Jan 21, 2009.Kyung Koo Yoon
 
창의와 열정, 소프트웨어 엔지니어
창의와 열정, 소프트웨어 엔지니어창의와 열정, 소프트웨어 엔지니어
창의와 열정, 소프트웨어 엔지니어Kyung Koo Yoon
 

Mehr von Kyung Koo Yoon (12)

Kubernetes
Kubernetes Kubernetes
Kubernetes
 
Java 8 고급 (5/6)
Java 8 고급 (5/6)Java 8 고급 (5/6)
Java 8 고급 (5/6)
 
Java 8 고급 (3/6)
Java 8 고급 (3/6)Java 8 고급 (3/6)
Java 8 고급 (3/6)
 
Java 8 고급 (2/6)
Java 8 고급 (2/6)Java 8 고급 (2/6)
Java 8 고급 (2/6)
 
Java 8 고급 (1/6)
Java 8 고급 (1/6)Java 8 고급 (1/6)
Java 8 고급 (1/6)
 
Spring Framework - Inversion of Control Container
Spring Framework - Inversion of Control ContainerSpring Framework - Inversion of Control Container
Spring Framework - Inversion of Control Container
 
Smart software engineer
Smart software engineerSmart software engineer
Smart software engineer
 
Lecture on Java Concurrency Day 3 on Feb 11, 2009.
Lecture on Java Concurrency Day 3 on Feb 11, 2009.Lecture on Java Concurrency Day 3 on Feb 11, 2009.
Lecture on Java Concurrency Day 3 on Feb 11, 2009.
 
Lecture on Java Concurrency Day 2 on Feb 4, 2009.
Lecture on Java Concurrency Day 2 on Feb 4, 2009.Lecture on Java Concurrency Day 2 on Feb 4, 2009.
Lecture on Java Concurrency Day 2 on Feb 4, 2009.
 
Lecture on Java Concurrency Day 4 on Feb 18, 2009.
Lecture on Java Concurrency Day 4 on Feb 18, 2009.Lecture on Java Concurrency Day 4 on Feb 18, 2009.
Lecture on Java Concurrency Day 4 on Feb 18, 2009.
 
Lecture on Java Concurrency Day 1 on Jan 21, 2009.
Lecture on Java Concurrency Day 1 on Jan 21, 2009.Lecture on Java Concurrency Day 1 on Jan 21, 2009.
Lecture on Java Concurrency Day 1 on Jan 21, 2009.
 
창의와 열정, 소프트웨어 엔지니어
창의와 열정, 소프트웨어 엔지니어창의와 열정, 소프트웨어 엔지니어
창의와 열정, 소프트웨어 엔지니어
 

Kürzlich hochgeladen

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 

Kürzlich hochgeladen (20)

SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 

Java 8 고급 (6/6)

  • 1. Java 엿새째 TmaxSoft R&D Center 1 113년 10월 22일 화
  • 2. 자바 교육 계획 1일 : Language, String, ClassLoader, Proxy 2일 : GC, Collections 3일 : Thread, Java Memory Model 4일 : AQS, ForkJoin, Concurrent Utils 5일 : IO, Generics, Annotation, RMI 6일 : Unsafe, Lambda (Java 8) 2 내겐 바스켓만 보여 (Flow 상태) 213년 10월 22일 화
  • 3. 오늘 내용 sun.misc.Unsafe Lambda (Java 8) 3 313년 10월 22일 화
  • 5. sun.misc.Unsafe 5 A collection of methods for performing low-level, unsafe operations park, unpark direct memory manipulation provide wrappers for malloc, realloc, free, memset, memcpy (not Java Heap) direct object memory manipulation CAS operations : compareAndSwap defineClass, defineAnonymousClass 513년 10월 22일 화
  • 6. Java is not safe with Unsafe 6 can easily corrupt memory fast serialization super array (non-Java heap) allocateMemory(long size) can cause JVM crash 613년 10월 22일 화
  • 7. Lambda 7 The  issue  being  debated  is  not  whether  closures  are  a   good  idea  -­‐  because  they  clearly  are  -­‐  but  whether   the  benefits  of  retrofi7ng  the  Java  language  with   closures  are  worth  the  costs. -­‐  Brian  Goetz 713년 10월 22일 화
  • 8. Functional Programming 8 lambda anonymous function with a single argument closure a block of code that may contain free (unbound) variables currying handling multiple argument function with lambda function 813년 10월 22일 화
  • 9. Java 8 Lambda Expression SAM (single abstract method) of an interface Java lambda expression a list of formal parameters and a body—an expression or block—expressed in terms of those parameters e.g, s -> s.toUpperCase() (int a, int b) -> a + b 9 913년 10월 22일 화
  • 10. Method Reference expression method reference : refer to a method without invoking it System::getProperty "abc"::length constructor reference : refer to a constructor without creating a new instance of the named class or array type ArrayList::new int[]::new e.g, Arrays.sort(myIntegerArray, Integer::compare) 10 1013년 10월 22일 화
  • 11. Java 8 Closure For both lambda bodies and inner classes, local variables in the enclosing context can only be referenced if they are final or effectively final. A variable is effectively final if it is never assigned to after its initialization. 11 1113년 10월 22일 화
  • 12. Java 8 Currying Currying :A technique of transforming a multi-argument function in such a way that it can be called as a chain of functions, each with a single argument. 12 1213년 10월 22일 화
  • 13. New Object-oriented feature mixin a class which contains a combination of methods from other classes. can also be viewed as an interface with implemented methods. Mixins encourage code reuse and avoid well-known pathologies associated with multiple inheritance. 13 1313년 10월 22일 화
  • 14. Java 8 Default Method Java’s language addition of mixin-like thing provides a default implementation for any class that implements the interface without overriding the method. allows new functionality to be added to existing (and perhaps already widely-distributed) interfaces. More generally, it provides a mechanism for multiple inheritance of behavior. 14 1413년 10월 22일 화
  • 15. Java 8 Changes to Interface Now, interface method can be default, static and abstract all the non-default, non-static methods in the interface are abstract as before Default methods of super-interface can be accessed <InterfaceName>.super.<methodName>() 15 1513년 10월 22일 화
  • 16. Java 8 Project Lambda Language Changes Still, No Function Type Functional Interface Default Method Streams invokeDynamic java.util.Spliterator 16 1613년 10월 22일 화
  • 17. Java Lambda ABC @interface java.lang.FunctionalInterface Just a hint for compiler (compile error if does not have SAM) any interface which has SAM is functional interface package java.util.function lambda function does not create additional classes unlike anonymous inner classes it creates a private static lambda method 17 1713년 10월 22일 화
  • 18. Streams handle aggregate operations DECLARATIVELY stream pipeline 1 source : collection, array, generator ftn, IO, ... 0 or more intermediate operations : filter, map, ... 1 terminal operation : forEach, reduce, sum, ... 18 1813년 10월 22일 화
  • 19. Stages of Streams txns.stream() .filter(txn -> txn.getBuyer().getAge() >= 65) .map(txn -> txn.getSeller()) .distinct() .sort(comparing(seller -> seller.getName())) .forEach(seller -> System.out.println(seller.getName()); 19 source intermediate intermediate intermediate intermediate terminal intermediate ops just setup pipeline and returns new stream 1913년 10월 22일 화
  • 20. Parallel Streams A stream pipeline can be created with an orientation of either serial or parallel Parallelism may be faster but introduces non-determinism Internally uses fork-join framework Collection c = ...; List r1 = c.stream().map(...).collect(toList()); List r2 = c.parallelStream().map(...).collect(toList()); 20 2013년 10월 22일 화
  • 22. MethodHandle java.lang.invoke 패키지 can store references to methods in the constant pool, load with LDC (load constant) can obtain a method handle for any method (or field access) But MethodHandle invocation performance is not good Lambda is language level method, MethodHandle is VM level method 22 2213년 10월 22일 화
  • 23. Lambda Invocation desugar implementation method private static boolean lambda$1(int minAge, Person p) { ... } lambda metafactory에 MethodHandle argument로 전달 invokeDynamic 호출 Predicate $p = invokedynamic[bootstrap=LambdaMetaFactory, ... ] moving more work from static compiler to runtime performance linkage, capture 비용은 inner class보다 싸지만 invoke 비용은 비싸다! 23 2313년 10월 22일 화
  • 24. invokeDynamic invokeStatic System.currentTimeMillis(), Math.log(1.0) invokeVirtual "hello".toUpperCase(), System.out.println() invokeInterface myList.add("happy happy"), myRunnable.run() invokeSpecial (constructor or super call) new ArrayList(), super.equals(other) 성능 비교 invokeStatic (2.7배) >> invokeDynamic (12.6배) >> reflection 24 2413년 10월 22일 화
  • 25. 다음 시간 예정 JEUS Web Engine 25 여러분의 전성시대는 언제였나요? 2513년 10월 22일 화