SlideShare ist ein Scribd-Unternehmen logo
1 von 61
Downloaden Sie, um offline zu lesen
Desde Java 8 ate Java 14
Víctor Orozco - @tuxtor
31 de marzo de 2020
Academik
1
¿O Java ainda é software livre?
De Java 8 a Java 14
Java 9
Java 10
Java 11
Java 12
Java 13
Java 14
Mundo real
2
3
¿O Java ainda é software livre?
¿Java?
• Linguagem
• VM
• Bibliotecas/API
O conjunto é a plataforma Java
4
¿Java?
• Linguagem
• VM
• Bibliotecas/API
O conjunto é a plataforma Java (TM)
4
¿Como Java é atualizado?
• JCP - Java Community Process
• JSR - Java Specification Request
• JEP - Java Enhancement Proposal
• JCK - Java Compatibility Kit
5
¿Como Java é atualizado? - Java Specification Request
6
¿Como Java é atualizado? - Java Enhancement Proposal
7
¿Como Java é atualizado? - Java Compatibility Kit
8
¿Como Java é atualizado? - Java Builds
9
¿Java livre?
Java é livre e gratuito.
Algumas empresas oferecem planos de suporte na sua ”versão”do Java.
10
De Java 8 a Java 14
¿O que eu recebo com cada versão nova do Java?
• Java - Linguagem
• Java - Bibliotecas e APIs
• Java - Maquina Virtual do Java
11
Java - Algumas das melhorias novas
• Java 9
• Modulos
• JShell
• HTTP/2
• Factory methods
• Java 10
• Type Inference
• Class Data Sharing
• Time based release
• Java 11
• String methods
• File methods
• Direct .java execution
• Java 12
• Switch expressions
• Java 13
• Text blocks
• Java 14
• Pattern matching
• Records
• Helpfull NPE
12
Java 9
JEP 222: jshell: The Java Shell (Read-Eval-Print Loop)
13
JEP 110: HTTP/2 Client
1 HttpRequest request = HttpRequest.newBuilder()
2 .uri(new URI("https://swapi.co/api/starships/9"))
3 .GET()
4 .build();
5
6 HttpResponse<String> response = HttpClient.newHttpClient()
7 .send(request, BodyHandlers.ofString());
8
9 System.out.println(response.body());
14
JEP 269: Convenience Factory Methods for Collections
Antes
1 Set<String> set = new HashSet<>();
2 set.add("a");
3 set.add("b");
4 set.add("c");
5 set = Collections.unmodifiableSet(set);
”Pro”
1 Set<String> set = Collections.unmodifiableSet(new HashSet<>(
Arrays.asList("a", "b", "c")));
Ahora
1 Set<String> set = Set.of("a", "b", "c");
15
JEP 213: Milling Project Coin - Private methods in interfaces
Antes
1 public interface Vehicle{
2 public void move();
3 }
Agora
1 public interface Vehicle {
2 public default void makeNoise ( ) {
3 System . out . p r i n t l n ("Making noise!") ;
4 createNoise ( ) ;
5 }
6
7 private void createNoise ( ) {
8 System . out . p r i n t l n ("Run run") ;
9 }
10 }
16
JEP 213: Milling Project Coin - Try-with-resources
Antes
1 BufferedReader reader = new BufferedReader(new FileReader("
langs.txt"));
2
3 try(BufferedReader innerReader = reader){
4 System.out.println(reader.readLine());
5 }
Ahora
1 BufferedReader reader = new BufferedReader(new FileReader("
langs.txt"));
2
3 try(reader){
4 System.out.println(reader.readLine());
5 } 17
Java 10
Java 10
286: Local-Variable Type Inference
296: Consolidate the JDK Forest into a Single Repository
304: Garbage-Collector Interface
307: Parallel Full GC for G1
310: Application Class-Data Sharing
312: Thread-Local Handshakes
313: Remove the Native-Header Generation Tool (javah)
314: Additional Unicode Language-Tag Extensions
316: Heap Allocation on Alternative Memory Devices
317: Experimental Java-Based JIT Compiler
319: Root Certificates
322: Time-Based Release Versioning
18
JEP 286: Local-Variable Type Inference
1 public static void main(String args[]){
2 var localValue = 99;
3 System.out.println(++localValue);
4 //localValue = "Foo"
5 }
19
JEP 310: Application Class-Data Sharing
1java −XX : ArchiveClassesAtExit=app−cs . jsa −j a r payara−micro −5.192. j a r
2java −XX : SharedArchiveFile=app−cs . jsa −j a r fpjava . j a r
20
JEP 310: Application Class-Data Sharing
21
JEP 310: Application Class-Data Sharing
22
JEP 322: Time-Based Release Versioning
23
JEP 322: Time-Based Release Versioning
24
Java 11
Java 11
181: Nest-Based Access Control
309: Dynamic Class-File Constants
315: Improve Aarch64 Intrinsics
318: Epsilon: A No-Op Garbage Collector
320: Remove the Java EE and CORBA Modules
321: HTTP Client (Standard)
323: Local-Variable Syntax for Lambda
Parameters
324: Key Agreement with Curve25519 and
Curve448
327: Unicode 10
328: Flight Recorder
329: ChaCha20 and Poly1305 Cryptographic
Algorithms
330: Launch Single-File Source-Code Programs
331: Low-Overhead Heap Profiling
332: Transport Layer Security (TLS) 1.3
333: ZGC: A Scalable Low-Latency Garbage
Collector (Experimental)
335: Deprecate the Nashorn JavaScript Engine
336: Deprecate the Pack200 Tools and API
25
JEP 323: Local-Variable Syntax for Lambda Parameters
Antes
1 BiPredicate<String,String> demoPredicate =
2 (String a, String b) -> a.equals(b);
3 BiPredicate<String,String> demoPredicate =
4 (a, b) -> a.equals(b);
Ahora
1 BiPredicate<String,String> demoPredicate =
2 (var a, var b) -> a.equals(b);
Posibilidades
1 (@Nonnull var x, @Nullable var y) -> x.process(y)
26
JEP 330: Launch Single-File Source-Code Programs
27
Java 12
Java 12
189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental)
230: Microbenchmark Suite
325: Switch Expressions (Preview)
334: JVM Constants API
340: One AArch64 Port, Not Two
341: Default CDS Archives
344: Abortable Mixed Collections for G1
346: Promptly Return Unused Committed Memory from G1
28
325: Switch Expressions (Preview)
Antes
1 String langType = "";
2 switch (args[0]) {
3 case "Java":
4 case "Scala":
5 case "Kotlin":
6 langType = "Static typed";
7 break;
8 case "Groovy":
9 case "JavaScript":
10 langType = "Dynamic typed";
11 break;
12 }
13 System.out.println(langType);
29
325: Switch Expressions (Preview)
Ahora
1 String langType = switch (args[0]) {
2 case "Java", "Scala", "Kotlin" -> "Static typed";
3 case "Groovy", "JavaScript" -> "Dynamic typed";
4 default -> {
5 System.out.println("This meant to be a processing
block");
6 yield "Probably LISP :)";
7 }
8 };
9 System.out.println(langType);
30
Java 13
Java 13
350: Dynamic CDS Archives
351: ZGC: Uncommit Unused Memory
353: Reimplement the Legacy Socket API
354: Switch Expressions (Preview)
355: Text Blocks (Preview)
31
355: Text Blocks (Preview)
Antes
1 String html = "<html>n" +
2 " <body>n" +
3 " <p>Hello, world</p>n" +
4 " </body>n" +
5 "</html>n";
Ahora
1 String html = """
2 <html>
3 <body>
4 <p>Hello, world</p>
5 </body>
6 </html>
7 """; 32
Java 14
Java 14
305: Pattern Matching for instanceof (Preview)
343: Packaging Tool (Incubator)
345: NUMA-Aware Memory Allocation for G1
349: JFR Event Streaming
352: Non-Volatile Mapped Byte Buffers
358: Helpful NullPointerExceptions
359: Records (Preview)
361: Switch Expressions (Standard)
362: Deprecate the Solaris and SPARC Ports
363: Remove the Concurrent Mark Sweep (CMS)
Garbage Collector
364: ZGC on macOS
365: ZGC on Windows
366: Deprecate the ParallelScavenge + SerialOld
GC Combination
367: Remove the Pack200 Tools and API
368: Text Blocks (Second Preview)
370: Foreign-Memory Access API (Incubator)
33
JEP 359: Records (Preview)
Data carrier
1 record Person(String name, String email, int age) {}
Uso
1 Person foo = new Person("Marco", "example@mail.com",99);
2 System.out.println(foo);
3 //foo.name = "Polo";
34
305: Pattern Matching for instanceof (Preview)
Antes
1 if(o instanceof Person){
2 Person p = (Person)o;
3 System.out.println("Hello " + p.name());
4 }else{
5 System.out.println("Unknown object");
6 }
Ahora
1 if(o instanceof Person p){
2 System.out.println("Hello " + p.name());
3 }else{
4 System.out.println("Unknown object");
5 }
35
Mundo real
Mundo real
Meu ”mundo real”
• ERP - 10 modulos (1 EAR, 9 EJB, 1 WAR), JBoss/Wildfly
• Venta/Geocerca (5 WAR) Payara Application Server
• POS - JavaFX y Windows D:
O quebra cabeça
• Módulos
• sun.misc.unsafe
• Corba e Java EE
• JavaFX
• IDE
• Licenciamento
36
Mundo real
O quebra cabeça
• Modulos
• sun.misc.unsafe
• Corba y Java EE
• JavaFX
• IDE
• Licencia
Estrategia
1. Testar a compatibilidade do runtime/servidor/framework
2. Multiples JVM com opção de mudar facilmente em desenvolvimento
3. Atualizar o compilador do Maven
4. Atualizar as bibliotecas
5. Embutir os módulos do Java EE no War/Ear
6. Atualizar o IDE
7. Preparar o projeto para módulos no caso do JavaFX
8. Definir de forma certa .O Java”que eu preciso
9. Rodar varias versões da JVM em produção
37
Compatibilidade runtime
Compatibilidade com Java 11
• Tomcat
• Spring
• Micronaut
• Vert.x
• JakartaEE (JBoss/Wildfly, OpenLiberty, Payara)
38
Várias JVMs
39
Bibliotecas
Geração dinâmica de Bytecode
• ByteBuddy
• ASM
• glib
• Spring
• Java EE
• Hibernate
• Mockito
40
Maven
• Maven 3.5.0
• Compiler 3.8.0
• surefire 2.22.0
• failsafe 2.22.0
• release version 11.0
41
Maven - JavaEE
JAF (java.activation)
1 <dependency>
2 <groupId>com.sun.activation</groupId>
3 <artifactId>javax.activation</artifactId>
4 <version>1.2.0</version>
5 </dependency>
CORBA = RIP
42
Maven - JavaEE
JAXB (java.xml.bind)
1 <!-- API -->
2 <dependency>
3 <groupId>jakarta.xml.bind</groupId>
4 <artifactId>jakarta.xml.bind-api</artifactId>
5 <version>2.3.2</version>
6 </dependency>
7
8 <!-- Runtime -->
9 <dependency>
10 <groupId>org.glassfish.jaxb</groupId>
11 <artifactId>jaxb-runtime</artifactId>
12 <version>2.3.2</version>
13 </dependency>
43
Maven - JavaEE
JAX-WS (java.xml.ws)
1 <!-- API -->
2 <dependency>
3 <groupId>jakarta.xml.ws</groupId>
4 <artifactId>jakarta.xml.ws-api</artifactId>
5 <version>2.3.2</version>
6 </dependency>
7
8 <!-- Runtime -->
9 <dependency>
10 <groupId>com.sun.xml.ws</groupId>
11 <artifactId>jaxws-rt</artifactId>
12 <version>2.3.2</version>
13 </dependency>
44
Maven - JavaEE
Common Annotations (java.xml.ws.annotation)
1 <dependency>
2 <groupId>javax.annotation</groupId>
3 <artifactId>javax.annotation-api</artifactId>
4 <version>1.3.1</version>
5 </dependency>
45
IDEs
IDEs compatíveis com Java 11
• Eclipse
• NetBeans
• IntelliJ IDEA
Alguns plug ins que podem ser problema
1. Glassfish
2. WebLogic
3. Icefaces
46
JavaFX
JavaFX agora não é mais um módulo embutido no JDK, mas da para usar ele no
JPMS, quase todo mundo usa a compilação do Gluon
47
¿Qual Java eu preciso?
Obrigatórios por contrato
• Software comercial da Oracle (HotSpot)
• Software comercial da SAP (SAP VM)
• Software comercial da Red Hat (OpenJDK + RHEL)
• Software comercial da IBM (J9)
Algumas outras
• AdoptOpenJDK (suporte da IBM en J9)
• Correto
• Azul Zulu
• Java na sua distribuição Linux
48
Várias JVMs em produção
Linux
• Docker
• RHEL
• Debian
• Gentoo
Windows
• Docker
• Variáveis de entorno proyecto/runtime
• O importante é estar saudável
49
Víctor Orozco
• vorozco@nabenik.com
• @tuxtor
• http://vorozco.com
• http://tuxtor.shekalug.org
This work is licensed under
Creative Commons Attribution-
NonCommercial-ShareAlike 3.0
Guatemala (CC BY-NC-SA 3.0 GT).
50
51

Weitere ähnliche Inhalte

Was ist angesagt?

Java Development EcoSystem
Java Development EcoSystemJava Development EcoSystem
Java Development EcoSystem
Alex Tumanoff
 
Remote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise LinuxRemote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise Linux
Giuseppe Paterno'
 
Thread dump troubleshooting
Thread dump troubleshootingThread dump troubleshooting
Thread dump troubleshooting
Jerry Chan
 

Was ist angesagt? (20)

자바 성능 강의
자바 성능 강의자바 성능 강의
자바 성능 강의
 
JSF2
JSF2JSF2
JSF2
 
Node4J: Running Node.js in a JavaWorld
Node4J: Running Node.js in a JavaWorldNode4J: Running Node.js in a JavaWorld
Node4J: Running Node.js in a JavaWorld
 
JDK9 Features (Summary, 31/Jul/2015) #JJUG
JDK9 Features (Summary, 31/Jul/2015) #JJUGJDK9 Features (Summary, 31/Jul/2015) #JJUG
JDK9 Features (Summary, 31/Jul/2015) #JJUG
 
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad PečanacJavantura v3 - ES6 – Future Is Now – Nenad Pečanac
Javantura v3 - ES6 – Future Is Now – Nenad Pečanac
 
Jolokia - JMX on Capsaicin (Devoxx 2011)
Jolokia - JMX on Capsaicin (Devoxx 2011)Jolokia - JMX on Capsaicin (Devoxx 2011)
Jolokia - JMX on Capsaicin (Devoxx 2011)
 
Monitoring and Tuning GlassFish
Monitoring and Tuning GlassFishMonitoring and Tuning GlassFish
Monitoring and Tuning GlassFish
 
Se lancer dans l'aventure microservices avec Spring Cloud - Julien Roy
Se lancer dans l'aventure microservices avec Spring Cloud - Julien RoySe lancer dans l'aventure microservices avec Spring Cloud - Julien Roy
Se lancer dans l'aventure microservices avec Spring Cloud - Julien Roy
 
QConSP 2018 - Java Module System
QConSP 2018 - Java Module SystemQConSP 2018 - Java Module System
QConSP 2018 - Java Module System
 
Ch10.애플리케이션 서버의 병목_발견_방법
Ch10.애플리케이션 서버의 병목_발견_방법Ch10.애플리케이션 서버의 병목_발견_방법
Ch10.애플리케이션 서버의 병목_발견_방법
 
vert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Javavert.x 3.1 - be reactive on the JVM but not only in Java
vert.x 3.1 - be reactive on the JVM but not only in Java
 
Ratpack JVM_MX Meetup February 2016
Ratpack JVM_MX Meetup February 2016Ratpack JVM_MX Meetup February 2016
Ratpack JVM_MX Meetup February 2016
 
Java Development EcoSystem
Java Development EcoSystemJava Development EcoSystem
Java Development EcoSystem
 
Testing the Enterprise layers, with Arquillian
Testing the Enterprise layers, with ArquillianTesting the Enterprise layers, with Arquillian
Testing the Enterprise layers, with Arquillian
 
Bulding a reactive game engine with Spring 5 & Couchbase
Bulding a reactive game engine with Spring 5 & CouchbaseBulding a reactive game engine with Spring 5 & Couchbase
Bulding a reactive game engine with Spring 5 & Couchbase
 
50 features of Java EE 7 in 50 minutes at JavaZone 2014
50 features of Java EE 7 in 50 minutes at JavaZone 201450 features of Java EE 7 in 50 minutes at JavaZone 2014
50 features of Java EE 7 in 50 minutes at JavaZone 2014
 
50 features of Java EE 7 in 50 minutes at Geecon 2014
50 features of Java EE 7 in 50 minutes at Geecon 201450 features of Java EE 7 in 50 minutes at Geecon 2014
50 features of Java EE 7 in 50 minutes at Geecon 2014
 
Remote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise LinuxRemote security with Red Hat Enterprise Linux
Remote security with Red Hat Enterprise Linux
 
Супер быстрая автоматизация тестирования на iOS
Супер быстрая автоматизация тестирования на iOSСупер быстрая автоматизация тестирования на iOS
Супер быстрая автоматизация тестирования на iOS
 
Thread dump troubleshooting
Thread dump troubleshootingThread dump troubleshooting
Thread dump troubleshooting
 

Ähnlich wie De Java 8 ate Java 14

Ähnlich wie De Java 8 ate Java 14 (20)

What to expect from Java 9
What to expect from Java 9What to expect from Java 9
What to expect from Java 9
 
DevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern JavaDevNexus 2020: Discover Modern Java
DevNexus 2020: Discover Modern Java
 
AMIS Oracle OpenWorld 2013 Review Part 3 - Fusion Middleware
AMIS Oracle OpenWorld 2013 Review Part 3 - Fusion MiddlewareAMIS Oracle OpenWorld 2013 Review Part 3 - Fusion Middleware
AMIS Oracle OpenWorld 2013 Review Part 3 - Fusion Middleware
 
Java 9 new features
Java 9 new featuresJava 9 new features
Java 9 new features
 
Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)Nodejs - A quick tour (v6)
Nodejs - A quick tour (v6)
 
Java 40 versions_sgp
Java 40 versions_sgpJava 40 versions_sgp
Java 40 versions_sgp
 
How to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machineHow to implement a simple dalvik virtual machine
How to implement a simple dalvik virtual machine
 
Java user group 2015 02-09-java8
Java user group 2015 02-09-java8Java user group 2015 02-09-java8
Java user group 2015 02-09-java8
 
Java user group 2015 02-09-java8
Java user group 2015 02-09-java8Java user group 2015 02-09-java8
Java user group 2015 02-09-java8
 
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
 
HotSpotコトハジメ
HotSpotコトハジメHotSpotコトハジメ
HotSpotコトハジメ
 
Real World Java 9 - JetBrains Webinar
Real World Java 9 - JetBrains WebinarReal World Java 9 - JetBrains Webinar
Real World Java 9 - JetBrains Webinar
 
introduction to node.js
introduction to node.jsintroduction to node.js
introduction to node.js
 
JCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of JavaJCConf 2018 - Retrospect and Prospect of Java
JCConf 2018 - Retrospect and Prospect of Java
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9
 
Native Java with GraalVM
Native Java with GraalVMNative Java with GraalVM
Native Java with GraalVM
 
Gradle
GradleGradle
Gradle
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9
 
Real World Java 9
Real World Java 9Real World Java 9
Real World Java 9
 

Mehr von Víctor Leonel Orozco López

Mehr von Víctor Leonel Orozco López (20)

Introducción al análisis de datos
Introducción al análisis de datosIntroducción al análisis de datos
Introducción al análisis de datos
 
From traditional to GitOps
From traditional to GitOpsFrom traditional to GitOps
From traditional to GitOps
 
Iniciando microservicios reales con JakartaEE/MicroProfile y arquetipos de Maven
Iniciando microservicios reales con JakartaEE/MicroProfile y arquetipos de MavenIniciando microservicios reales con JakartaEE/MicroProfile y arquetipos de Maven
Iniciando microservicios reales con JakartaEE/MicroProfile y arquetipos de Maven
 
Desde la TV, hasta la nube, el ecosistema de Java en 26 años
Desde la TV, hasta la nube, el ecosistema de Java en 26 añosDesde la TV, hasta la nube, el ecosistema de Java en 26 años
Desde la TV, hasta la nube, el ecosistema de Java en 26 años
 
Bootstraping real world Jakarta EE/MicroProfile microservices with Maven Arch...
Bootstraping real world Jakarta EE/MicroProfile microservices with Maven Arch...Bootstraping real world Jakarta EE/MicroProfile microservices with Maven Arch...
Bootstraping real world Jakarta EE/MicroProfile microservices with Maven Arch...
 
Tolerancia a fallas, service mesh y chassis
Tolerancia a fallas, service mesh y chassisTolerancia a fallas, service mesh y chassis
Tolerancia a fallas, service mesh y chassis
 
Explorando los objetos centrales de Kubernetes con Oracle Cloud
Explorando los objetos centrales de Kubernetes con Oracle CloudExplorando los objetos centrales de Kubernetes con Oracle Cloud
Explorando los objetos centrales de Kubernetes con Oracle Cloud
 
Introducción a GraalVM Native para aplicaciones JVM
Introducción a GraalVM Native para aplicaciones JVMIntroducción a GraalVM Native para aplicaciones JVM
Introducción a GraalVM Native para aplicaciones JVM
 
Desarrollo moderno con DevOps y Cloud Native
Desarrollo moderno con DevOps y Cloud NativeDesarrollo moderno con DevOps y Cloud Native
Desarrollo moderno con DevOps y Cloud Native
 
Gestión de proyectos con Maven
Gestión de proyectos con MavenGestión de proyectos con Maven
Gestión de proyectos con Maven
 
MicroProfile benefits for your monolithic applications
MicroProfile benefits for your monolithic applicationsMicroProfile benefits for your monolithic applications
MicroProfile benefits for your monolithic applications
 
Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...
Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...
Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...
 
Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...
Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...
Actualizando aplicaciones empresariales en Java desde Java 8 on premise hasta...
 
Consejos y el camino del desarrollador de software
Consejos y el camino del desarrollador de softwareConsejos y el camino del desarrollador de software
Consejos y el camino del desarrollador de software
 
Seguridad de aplicaciones Java/JakartaEE con OWASP Top 10
Seguridad de aplicaciones Java/JakartaEE con OWASP Top 10Seguridad de aplicaciones Java/JakartaEE con OWASP Top 10
Seguridad de aplicaciones Java/JakartaEE con OWASP Top 10
 
Introducción a Kotlin para desarrolladores Java
Introducción a Kotlin para desarrolladores JavaIntroducción a Kotlin para desarrolladores Java
Introducción a Kotlin para desarrolladores Java
 
Programación con ECMA6 y TypeScript
Programación con ECMA6 y TypeScriptProgramación con ECMA6 y TypeScript
Programación con ECMA6 y TypeScript
 
Empaquetando aplicaciones Java con Docker y Kubernetes
Empaquetando aplicaciones Java con Docker y KubernetesEmpaquetando aplicaciones Java con Docker y Kubernetes
Empaquetando aplicaciones Java con Docker y Kubernetes
 
MicroProfile benefits for monolitic applications
MicroProfile benefits for monolitic applicationsMicroProfile benefits for monolitic applications
MicroProfile benefits for monolitic applications
 
Kotlin+MicroProfile: Enseñando trucos de 20 años a un nuevo lenguaje
Kotlin+MicroProfile: Enseñando trucos de 20 años a un nuevo lenguajeKotlin+MicroProfile: Enseñando trucos de 20 años a un nuevo lenguaje
Kotlin+MicroProfile: Enseñando trucos de 20 años a un nuevo lenguaje
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot ModelNavi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Navi Mumbai Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

De Java 8 ate Java 14

  • 1. Desde Java 8 ate Java 14 Víctor Orozco - @tuxtor 31 de marzo de 2020 Academik 1
  • 2. ¿O Java ainda é software livre? De Java 8 a Java 14 Java 9 Java 10 Java 11 Java 12 Java 13 Java 14 Mundo real 2
  • 3. 3
  • 4. ¿O Java ainda é software livre?
  • 5. ¿Java? • Linguagem • VM • Bibliotecas/API O conjunto é a plataforma Java 4
  • 6. ¿Java? • Linguagem • VM • Bibliotecas/API O conjunto é a plataforma Java (TM) 4
  • 7. ¿Como Java é atualizado? • JCP - Java Community Process • JSR - Java Specification Request • JEP - Java Enhancement Proposal • JCK - Java Compatibility Kit 5
  • 8. ¿Como Java é atualizado? - Java Specification Request 6
  • 9. ¿Como Java é atualizado? - Java Enhancement Proposal 7
  • 10. ¿Como Java é atualizado? - Java Compatibility Kit 8
  • 11. ¿Como Java é atualizado? - Java Builds 9
  • 12. ¿Java livre? Java é livre e gratuito. Algumas empresas oferecem planos de suporte na sua ”versão”do Java. 10
  • 13. De Java 8 a Java 14
  • 14. ¿O que eu recebo com cada versão nova do Java? • Java - Linguagem • Java - Bibliotecas e APIs • Java - Maquina Virtual do Java 11
  • 15. Java - Algumas das melhorias novas • Java 9 • Modulos • JShell • HTTP/2 • Factory methods • Java 10 • Type Inference • Class Data Sharing • Time based release • Java 11 • String methods • File methods • Direct .java execution • Java 12 • Switch expressions • Java 13 • Text blocks • Java 14 • Pattern matching • Records • Helpfull NPE 12
  • 17. JEP 222: jshell: The Java Shell (Read-Eval-Print Loop) 13
  • 18. JEP 110: HTTP/2 Client 1 HttpRequest request = HttpRequest.newBuilder() 2 .uri(new URI("https://swapi.co/api/starships/9")) 3 .GET() 4 .build(); 5 6 HttpResponse<String> response = HttpClient.newHttpClient() 7 .send(request, BodyHandlers.ofString()); 8 9 System.out.println(response.body()); 14
  • 19. JEP 269: Convenience Factory Methods for Collections Antes 1 Set<String> set = new HashSet<>(); 2 set.add("a"); 3 set.add("b"); 4 set.add("c"); 5 set = Collections.unmodifiableSet(set); ”Pro” 1 Set<String> set = Collections.unmodifiableSet(new HashSet<>( Arrays.asList("a", "b", "c"))); Ahora 1 Set<String> set = Set.of("a", "b", "c"); 15
  • 20. JEP 213: Milling Project Coin - Private methods in interfaces Antes 1 public interface Vehicle{ 2 public void move(); 3 } Agora 1 public interface Vehicle { 2 public default void makeNoise ( ) { 3 System . out . p r i n t l n ("Making noise!") ; 4 createNoise ( ) ; 5 } 6 7 private void createNoise ( ) { 8 System . out . p r i n t l n ("Run run") ; 9 } 10 } 16
  • 21. JEP 213: Milling Project Coin - Try-with-resources Antes 1 BufferedReader reader = new BufferedReader(new FileReader(" langs.txt")); 2 3 try(BufferedReader innerReader = reader){ 4 System.out.println(reader.readLine()); 5 } Ahora 1 BufferedReader reader = new BufferedReader(new FileReader(" langs.txt")); 2 3 try(reader){ 4 System.out.println(reader.readLine()); 5 } 17
  • 23. Java 10 286: Local-Variable Type Inference 296: Consolidate the JDK Forest into a Single Repository 304: Garbage-Collector Interface 307: Parallel Full GC for G1 310: Application Class-Data Sharing 312: Thread-Local Handshakes 313: Remove the Native-Header Generation Tool (javah) 314: Additional Unicode Language-Tag Extensions 316: Heap Allocation on Alternative Memory Devices 317: Experimental Java-Based JIT Compiler 319: Root Certificates 322: Time-Based Release Versioning 18
  • 24. JEP 286: Local-Variable Type Inference 1 public static void main(String args[]){ 2 var localValue = 99; 3 System.out.println(++localValue); 4 //localValue = "Foo" 5 } 19
  • 25. JEP 310: Application Class-Data Sharing 1java −XX : ArchiveClassesAtExit=app−cs . jsa −j a r payara−micro −5.192. j a r 2java −XX : SharedArchiveFile=app−cs . jsa −j a r fpjava . j a r 20
  • 26. JEP 310: Application Class-Data Sharing 21
  • 27. JEP 310: Application Class-Data Sharing 22
  • 28. JEP 322: Time-Based Release Versioning 23
  • 29. JEP 322: Time-Based Release Versioning 24
  • 31. Java 11 181: Nest-Based Access Control 309: Dynamic Class-File Constants 315: Improve Aarch64 Intrinsics 318: Epsilon: A No-Op Garbage Collector 320: Remove the Java EE and CORBA Modules 321: HTTP Client (Standard) 323: Local-Variable Syntax for Lambda Parameters 324: Key Agreement with Curve25519 and Curve448 327: Unicode 10 328: Flight Recorder 329: ChaCha20 and Poly1305 Cryptographic Algorithms 330: Launch Single-File Source-Code Programs 331: Low-Overhead Heap Profiling 332: Transport Layer Security (TLS) 1.3 333: ZGC: A Scalable Low-Latency Garbage Collector (Experimental) 335: Deprecate the Nashorn JavaScript Engine 336: Deprecate the Pack200 Tools and API 25
  • 32. JEP 323: Local-Variable Syntax for Lambda Parameters Antes 1 BiPredicate<String,String> demoPredicate = 2 (String a, String b) -> a.equals(b); 3 BiPredicate<String,String> demoPredicate = 4 (a, b) -> a.equals(b); Ahora 1 BiPredicate<String,String> demoPredicate = 2 (var a, var b) -> a.equals(b); Posibilidades 1 (@Nonnull var x, @Nullable var y) -> x.process(y) 26
  • 33. JEP 330: Launch Single-File Source-Code Programs 27
  • 35. Java 12 189: Shenandoah: A Low-Pause-Time Garbage Collector (Experimental) 230: Microbenchmark Suite 325: Switch Expressions (Preview) 334: JVM Constants API 340: One AArch64 Port, Not Two 341: Default CDS Archives 344: Abortable Mixed Collections for G1 346: Promptly Return Unused Committed Memory from G1 28
  • 36. 325: Switch Expressions (Preview) Antes 1 String langType = ""; 2 switch (args[0]) { 3 case "Java": 4 case "Scala": 5 case "Kotlin": 6 langType = "Static typed"; 7 break; 8 case "Groovy": 9 case "JavaScript": 10 langType = "Dynamic typed"; 11 break; 12 } 13 System.out.println(langType); 29
  • 37. 325: Switch Expressions (Preview) Ahora 1 String langType = switch (args[0]) { 2 case "Java", "Scala", "Kotlin" -> "Static typed"; 3 case "Groovy", "JavaScript" -> "Dynamic typed"; 4 default -> { 5 System.out.println("This meant to be a processing block"); 6 yield "Probably LISP :)"; 7 } 8 }; 9 System.out.println(langType); 30
  • 39. Java 13 350: Dynamic CDS Archives 351: ZGC: Uncommit Unused Memory 353: Reimplement the Legacy Socket API 354: Switch Expressions (Preview) 355: Text Blocks (Preview) 31
  • 40. 355: Text Blocks (Preview) Antes 1 String html = "<html>n" + 2 " <body>n" + 3 " <p>Hello, world</p>n" + 4 " </body>n" + 5 "</html>n"; Ahora 1 String html = """ 2 <html> 3 <body> 4 <p>Hello, world</p> 5 </body> 6 </html> 7 """; 32
  • 42. Java 14 305: Pattern Matching for instanceof (Preview) 343: Packaging Tool (Incubator) 345: NUMA-Aware Memory Allocation for G1 349: JFR Event Streaming 352: Non-Volatile Mapped Byte Buffers 358: Helpful NullPointerExceptions 359: Records (Preview) 361: Switch Expressions (Standard) 362: Deprecate the Solaris and SPARC Ports 363: Remove the Concurrent Mark Sweep (CMS) Garbage Collector 364: ZGC on macOS 365: ZGC on Windows 366: Deprecate the ParallelScavenge + SerialOld GC Combination 367: Remove the Pack200 Tools and API 368: Text Blocks (Second Preview) 370: Foreign-Memory Access API (Incubator) 33
  • 43. JEP 359: Records (Preview) Data carrier 1 record Person(String name, String email, int age) {} Uso 1 Person foo = new Person("Marco", "example@mail.com",99); 2 System.out.println(foo); 3 //foo.name = "Polo"; 34
  • 44. 305: Pattern Matching for instanceof (Preview) Antes 1 if(o instanceof Person){ 2 Person p = (Person)o; 3 System.out.println("Hello " + p.name()); 4 }else{ 5 System.out.println("Unknown object"); 6 } Ahora 1 if(o instanceof Person p){ 2 System.out.println("Hello " + p.name()); 3 }else{ 4 System.out.println("Unknown object"); 5 } 35
  • 46. Mundo real Meu ”mundo real” • ERP - 10 modulos (1 EAR, 9 EJB, 1 WAR), JBoss/Wildfly • Venta/Geocerca (5 WAR) Payara Application Server • POS - JavaFX y Windows D: O quebra cabeça • Módulos • sun.misc.unsafe • Corba e Java EE • JavaFX • IDE • Licenciamento 36
  • 47. Mundo real O quebra cabeça • Modulos • sun.misc.unsafe • Corba y Java EE • JavaFX • IDE • Licencia Estrategia 1. Testar a compatibilidade do runtime/servidor/framework 2. Multiples JVM com opção de mudar facilmente em desenvolvimento 3. Atualizar o compilador do Maven 4. Atualizar as bibliotecas 5. Embutir os módulos do Java EE no War/Ear 6. Atualizar o IDE 7. Preparar o projeto para módulos no caso do JavaFX 8. Definir de forma certa .O Java”que eu preciso 9. Rodar varias versões da JVM em produção 37
  • 48. Compatibilidade runtime Compatibilidade com Java 11 • Tomcat • Spring • Micronaut • Vert.x • JakartaEE (JBoss/Wildfly, OpenLiberty, Payara) 38
  • 50. Bibliotecas Geração dinâmica de Bytecode • ByteBuddy • ASM • glib • Spring • Java EE • Hibernate • Mockito 40
  • 51. Maven • Maven 3.5.0 • Compiler 3.8.0 • surefire 2.22.0 • failsafe 2.22.0 • release version 11.0 41
  • 52. Maven - JavaEE JAF (java.activation) 1 <dependency> 2 <groupId>com.sun.activation</groupId> 3 <artifactId>javax.activation</artifactId> 4 <version>1.2.0</version> 5 </dependency> CORBA = RIP 42
  • 53. Maven - JavaEE JAXB (java.xml.bind) 1 <!-- API --> 2 <dependency> 3 <groupId>jakarta.xml.bind</groupId> 4 <artifactId>jakarta.xml.bind-api</artifactId> 5 <version>2.3.2</version> 6 </dependency> 7 8 <!-- Runtime --> 9 <dependency> 10 <groupId>org.glassfish.jaxb</groupId> 11 <artifactId>jaxb-runtime</artifactId> 12 <version>2.3.2</version> 13 </dependency> 43
  • 54. Maven - JavaEE JAX-WS (java.xml.ws) 1 <!-- API --> 2 <dependency> 3 <groupId>jakarta.xml.ws</groupId> 4 <artifactId>jakarta.xml.ws-api</artifactId> 5 <version>2.3.2</version> 6 </dependency> 7 8 <!-- Runtime --> 9 <dependency> 10 <groupId>com.sun.xml.ws</groupId> 11 <artifactId>jaxws-rt</artifactId> 12 <version>2.3.2</version> 13 </dependency> 44
  • 55. Maven - JavaEE Common Annotations (java.xml.ws.annotation) 1 <dependency> 2 <groupId>javax.annotation</groupId> 3 <artifactId>javax.annotation-api</artifactId> 4 <version>1.3.1</version> 5 </dependency> 45
  • 56. IDEs IDEs compatíveis com Java 11 • Eclipse • NetBeans • IntelliJ IDEA Alguns plug ins que podem ser problema 1. Glassfish 2. WebLogic 3. Icefaces 46
  • 57. JavaFX JavaFX agora não é mais um módulo embutido no JDK, mas da para usar ele no JPMS, quase todo mundo usa a compilação do Gluon 47
  • 58. ¿Qual Java eu preciso? Obrigatórios por contrato • Software comercial da Oracle (HotSpot) • Software comercial da SAP (SAP VM) • Software comercial da Red Hat (OpenJDK + RHEL) • Software comercial da IBM (J9) Algumas outras • AdoptOpenJDK (suporte da IBM en J9) • Correto • Azul Zulu • Java na sua distribuição Linux 48
  • 59. Várias JVMs em produção Linux • Docker • RHEL • Debian • Gentoo Windows • Docker • Variáveis de entorno proyecto/runtime • O importante é estar saudável 49
  • 60. Víctor Orozco • vorozco@nabenik.com • @tuxtor • http://vorozco.com • http://tuxtor.shekalug.org This work is licensed under Creative Commons Attribution- NonCommercial-ShareAlike 3.0 Guatemala (CC BY-NC-SA 3.0 GT). 50
  • 61. 51