-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
781 lines (615 loc) · 31.2 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
<!doctype html>
<html lang="pt-BR">
<head>
<meta charset="utf-8">
<title>Java 9: Uma visão geral sobre as novas funcionalidades </title>
<meta name="description" content="Uma visão geral sobre as novas funcionalidades de Java 9">
<meta name="author" content="SouJava">
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<link rel="stylesheet" href="presentation/css/reveal.css">
<link rel="stylesheet" href="presentation/css/theme/black.css" id="theme">
<!-- Code syntax highlighting -->
<link rel="stylesheet" href="presentation/lib/css/zenburn.css">
<!-- Custom, overriding CSS -->
<link rel="stylesheet" href="presentation/css/custom.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement('link');
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match(/print-pdf/gi) ? 'presentation/css/print/pdf.css' : 'presentation/css/print/paper.css';
document.getElementsByTagName('head')[0].appendChild(link);
</script>
<!--[if lt IE 9]>
<script src="presentation/lib/js/html5shiv.js"></script>
<![endif]-->
</head>
<body>
<div class="reveal">
<!-- Any section element inside of this container is displayed as a slide -->
<div class="slides">
<!--
=== Title ===============================================================================
-->
<section>
<div style="width: 80%; margin: 0 auto">
<h1 style="margin: 00px 0 80px 0">Java 9</h1>
<h5><i> Light Talking:</i></h5>
<h3 style="text-align: left" class="emphasize">Uma visão geral sobre <br/>as novas funcionalidades</h3>
</div>
<div id="helpfooter">
<code>?</code> para ajuda, <code>espaço</code> para navegar
</p>
</div>
<div id="version">
2017-03-28
</div>
<div class="profile" style="position: absolute; top: 150px; left: 800px">
<div class="profile-sidebar">
<div class="profile-userpic">
<img data-src="presentation/img/logo_sou_java.png" class="img-responsive" alt="">
</div>
<div class="profile-usertitle">
<div class="profile-usertitle-name">
SouJava
</div>
<div class="profile-usertitle-job">
Grupo de usuários Java
</div>
</div>
</div>
<div class="profile-content">
<a href="https://twitter.com/soujava">@soujava</a>
</div>
</div>
<div id="rightsection">
<b>Dica: </b><a class="c-ref" href="#"><code>arquivo</code></a> e <a href="#" class="jep">JEP</a> são links diretos
</div>
<div id="licence">
<a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
<img alt="Creative Commons Lizenzvertrag"
src="https://i.creativecommons.org/l/by-nc-sa/4.0/80x15.png"/></a>
<br/><span xmlns:dct="http://purl.org/dc/terms/"
href="http://purl.org/dc/dcmitype/InteractiveResource"
property="dct:title" rel="dct:type">Apresentação do Java 9 e uma visão geral sobre os novos recursos</span>
por
<a xmlns:cc="http://creativecommons.org/ns#" href="https://twitter.com/soujava"
property="cc:attributionName" rel="cc:attributionURL">SouJava</a>
<br/>licenciado por
<a rel="license" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.</a>.
Baseado em partes do trabalho da <a xmlns:dct="http://purl.org/dc/terms/"
href="http://lab.hakim.se/reveal-js/" rel="dct:source">Reveal.JS</a>.
</div>
</section>
<!--
=== Overview ============================================================================
-->
<section>
<!--<section>-->
<!--<h1>Java 9</h1>-->
<!--<h3>in a nutshell</h3>-->
<!--</section>-->
<!--<section>-->
<div>
<div data-markdown>
## Especificação
</div>
<div style="width: 85%; margin: 0 auto;">
<div data-markdown class="twocol">
##### Especificação
- **82** JEP targeted
- GA Release: <!-- -->
~~2016-09-22~~ **2017-03-23**
- Brewing since: 2014-08-11
</div>
<div data-markdown class="twocol">
##### Destaques
- Jigsaw
- Tooling
- HTTP API
- Detalhes da linguagem
</div>
</div>
</div>
<!--</section>-->
</section>
<!--
=== Tooling =============================================================================
-->
<section>
<section>
<div data-markdown>
# FERRAMENTAS
</div>
</section>
<section>
<div data-markdown>
<script type="text/template">
### REPL: `jshell`
```
⋊> ~ jshell
| Welcome to JShell -- Version 9-ea
| For an introduction type: /help intro
jshell> 3 + 4 * 7
$1 ==> 31
jshell> int add(int a, int b) {
...> return a+b;
...> }
| created method add(int,int)
jshell> add(25, $1)
$3 ==> 56
```
<!-- .element: class="small" -->
Obtenha uma visão geral com `/help` e `/help shortcuts`
</script>
</div>
</section>
<section>
<div data-markdown class="container">
<script type="text/template">
### HTML5 Javadoc
- Habilite via parâmetro `-html5`
- Busca capacitada
- HTML5 e Doclet API atualizada
- DocLint melhorado: <span>`-Xdoclint/package:java.*,javax.*`</span> <!-- .element: class="small" -->
</script>
</div>
</section>
<section>
<h3>Exemplo de uma busca no HTML5 Javadoc</h3>
<img src="presentation/img/javadoc-html5-example.png" alt="Example Java 9 Javadoc output with HTML5 enabled">
</section>
<section>
<div data-markdown style="width: 60%; margin: 0 auto">
<script type="text/template">
### Cross compiling
#### e o `javac -release` flag
````
javac - release N
````
<!-- .element: class="small" -->
...é equivalente a
````
javac -source N -target N –bootclasspath rtN.jar ...
````
<!-- .element: class="small" -->
</script>
</div>
</section>
</section>
<section>
<section>
<div class="small">
<div data-markdown>
## Detalhes da linguagem
</div>
<div class="twocol">
<div data-markdown>
<script type="text/template">
##### Processos de controle [`ControlProcess.java`](https://github.com/soujava/java9-em-acao/blob/master/playground/src/main/java/de/exxcellent/java9/process/ControlProcess.java) <!-- .element: class="c-ref" -->
- Recuperação e inspeção de processos
- Finalização de processos
##### Coleções[`ImmutableCollections.java`](https://github.com/soujava/java9-em-acao/blob/master/playground/src/main/java/de/exxcellent/java9/collections/ImmutableCollections.java) <!-- .element: class="c-ref" -->
```
List/Map/Set.of(1, 2, 3);
```
##### Enhanced Deprecado
````java
@Deprecated(since ="1.5", forRemoval = true)
````
</script>
</div>
</div>
<div class="twocol" data-markdown>
<script type="text/template">
##### Stream
```
InputStream.transferTo(OutputStream out);
```
##### StackWalker [`StackWalkerExample.java`](https://github.com/soujava/java9-em-acao/blob/master/playground/src/main/java/de/exxcellent/java9/util/StackWalkerExample.java) <!-- .element: class="c-ref" -->
##### Nome de pacote
````
this.getClass().getPackageName()
````
</script>
</div>
</div>
</section>
<section>
<div data-markdown>
### Controle de Processo
````java
<pre>// Obtendo o próprio PIDs ou de processos já iniciados
out.println("Your pid is " + ProcessHandle.current().getPid());
Process p = Runtime.getRuntime().exec("sleep 1h");
ProcessHandle h = ProcessHandle.of(p.getPid()) // Opcional
.orElseThrow(IllegalStateException::new);
// Fazendo algo ao sair de um processo // CompletableFuture
h.onExit().thenRun( ()-> out.println("Sleeper exited") );
// Pegando informação do processo
out.printf("[%d] %s - %s\n", h.getPid(),
h.info().user().orElse("unknown"),
h.info().commandLine().orElse("none"));
// Finalizando o processo
h.destroy();</pre>
````
</div>
</section>
<section>
<div data-markdown>
### Fábricas de coleções imutáveis
````java
<pre>/* Seções de comentários iriam quebrar ... */
List<Integer> listOfNumbers = List.of(1, 2, 3, 4, 5/*, null*/);
Set<Integer> setOfNumbers = Set.of(1, 2, 3, 4, 5/*, 1*/);
Map<String, String> mapOfString =
Map.of("key1", "value1", "key2", "value2");
Map<String, String> moreMapOfString =
Map.ofEntries(
Map.entry("key1", "value1"),
Map.entry("key2", "value2")/*,
Map.entry("key1", "value3")*/
);
````
</div>
</section>
<section>
<div data-markdown style="font-size: .92em;">
### StackWalker
````java
<pre>// retorno de classe/método somente para nossas classes.
private static List<String> walkAndFilterStackframe() {
return StackWalker.getInstance().walk(s ->
s.map( frame-> frame.getClassName()+"/"+frame.getMethodName())
.filter(name -> name.startsWith("de.exxcellent"))
.limit(10)
.collect(Collectors.toList()) );
}</pre>
````
</div>
</section>
<section>
<div data-markdown>
### Novas Utilidades para o Input Stream
````java
<pre>// Todos os bytes de um InputStream de uma só vez
byte[] result = new ByteArrayInputStream(buf)
.readAllBytes();
// Diretamente redirecionado de um InputStream para um OutputStream
new ByteArrayInputStream(buf)
.transferTo(System.out);</pre>
````
</div>
</section>
</section>
<section>
<div data-markdown>
### HTTP/2 Client
````java
/**
* A API HTTP funciona de forma assíncrona e síncrona. No
* modo assíncrono, o trabalho é executado em threads (ExecutorService).
*/
public static void main(String[] args) throws Exception {
HttpClient.getDefault()
.request(URI.create("https://www.exxcellent.de"))
.GET()
.responseAsync() // CompletableFuture :D
.thenAccept(httpResponse ->
out.println(httpResponse.body(HttpResponse.asString()))
);
Thread.sleep(999); // Dê algum tempo para a thread trabalhar.
}
````
</div>
</section>
<!--
=== Details =============================================================================
-->
<section>
<section>
<div data-markdown>
# Jigsaw
</div>
</section>
<section>
<div data-markdown>
<script type="text/template">
## Jigsaw [JEP 201](http://openjdk.java.net/jeps/201)<!-- .element: class="jep" -->
> Módulos agrupam um ou mais pacotes
> e oferecem um encapsulamento melhor do que jars
- Permite **diminuir o tempo de execução de um JAR** → IoT
- **Ponto forte:** Em um módulo: `public` não permanece público para outros
- _Sad:_ Não possui módulo de versão
</script>
</div>
</section>
<section>
<div data-markdown>
<script type="text/template">
### Como funciona (1)
Aqrquivos `module-info.java` declaram dependências
```java
module com.mysql.jdbc {
// Dependência de móduolo
requires java.sql;
// pacote exportado de um módulo
exports com.mysql.jdbc;
// Implementação de um serviço com instância
provides java.sql.Driver with com.mysql.jdbc.Driver;
}
```
</script>
</div>
</section>
<section>
<div data-markdown class="container">
<script type="text/template">
### Como funciona (2)
##### Alterações do `javac` e `java` para usar módulos ao invés de JARs
````
javac -mp modulepath ...
java -mp modulepath -m modulename/moduleclass
````
##### Linker
`jlink` pode ser utlizado para unir um conjunto de módulos, juntamente com suas dependências transitivas,
para criar uma imagem modular de tempo-execução
</script>
</div>
</section>
<section>
<div data-markdown >
<script type="text/template">
### `ServiceLoader` utilizando módulos (1)
````
public abstract class BillingService {
public static BillingService getInstance() {
// Java SPI to find the instance
ServiceLoader<BillingServiceProvider> sl =
ServiceLoader.load(BillingServiceProvider.class);
// Fetch first provider implementation
Iterator<BillingServiceProvider> it = sl.iterator();
return it.next().buildBillingService();
}
public abstract String takeMoney();
}
````
</script>
</div>
</section>
<section>
<div data-markdown style="font-size: .9em">
<script type="text/template">
### `ServiceLoader` usando módulos (2)
````java
module anothermodule {
exports de.exxcellent.anothermodule;
requires de.exxcellent.java9;
// Prover uma instância de serviços(SPI com módulos Jigsaw)
provides de.exxcellent.java9.jigsaw.spi.BillingServiceProvider
with de.exxcellent.anothermodule.spi.MastercardBillingServiceProvider;
}
````
</script>
</div>
</section>
<section>
<div data-markdown>
<script type="text/template">
### Como funciona (3)
````
$ mkdir -p target/module/de.exxcellent.java9
$ mkdir -p target/module/anothermodule
$ javac $(find playground/src/main/java -name "*.java") \
-d target/module/de.exxcellent.java9
$ javac $(find playground-dependent/src/main/java -name "*.java")\
-d target/module/anothermodule \
-modulepath target/module
$ java -modulepath target/module \
-m anothermodule/de.exxcellent.anothermodule.TestJigsawSPI
Mastercard billed the money!
````
</script>
</div>
</section>
<section>
<div class="container">
<div data-markdown>
### Ferramentas
- Lista módulos incorporados: `java –listmods`
- Buscando dependências: `jdeps –jdkinternals app.jar`
</div>
<div data-markdown style="margin-top: 60px">
### Recursos
- [Breve resumo da JVM ](http://cr.openjdk.java.net/~mr/jigsaw/ea/module-summary.html)
- [O estado do módulo de sistema](http://openjdk.java.net/projects/jigsaw/spec/sotms/)
</div>
</div>
</section>
</section>
<section>
<section>
<div class="small">
<div data-markdown>
## Muitos Detalhes (obscuros)
</div>
<div class="twocol" data-markdown>
<script type="text/template">
##### Performance
- Melhora nos travamentos [JEP 102](http://openjdk.java.net/jeps/143)<!-- .element: class="jep" -->
- Cache de código segmentado [JEP 197](http://openjdk.java.net/jeps/197)<!-- .element: class="jep" -->
- Compilação Inteligente do Java [JEP 199](http://openjdk.java.net/jeps/199)<!-- .element: class="jep" -->
##### Logging unificado da JVM
- Mesmo logging para _toda_ JVM (GC, ...)
[JEP 158](http://openjdk.java.net/jeps/158) <!-- .element: class="jep" -->
##### Coisas obscuras
- Controle do Compilador JVM [JEP 165](http://openjdk.java.net/jeps/165)<!-- .element: class="jep" -->
- Securança UDP (DTLS) [JEP 219](http://openjdk.java.net/jeps/219)<!-- .element: class="jep" -->
- Handles Variáveis [JEP 193](http://openjdk.java.net/jeps/193)<!-- .element: class="jep" -->
- Remoção de combinações deprecadas do GC
[JEP 214](http://openjdk.java.net/jeps/214) <!-- .element: class="jep" -->
- Processamento de instruções de importação de forma correta
[JEP 216](http://openjdk.java.net/jeps/216) <!-- .element: class="jep" -->
</script>
</div>
<div class="twocol" data-markdown>
<script type="text/template">
##### HTTP 2 Client
- Implementações HTTP/2 e WebSocket
[JEP 110](http://openjdk.java.net/jeps/110) <!-- .element: class="jep" -->
[`HttpClientExample.java`](https://github.com/soujava/java9-em-acao/blob/master/playground/src/main/java/de/exxcellent/java9/http/HttpClientExample.java) <!-- .element: class="c-ref" -->
##### Fixes / Enhancements
- Propriedade de Arquivos UTF-8
[JEP 226](http://openjdk.java.net/jeps/226) <!-- .element: class="jep" -->
- Gráficos HiDPI no Windows e Linux
[JEP 263](http://openjdk.java.net/jeps/263) <!-- .element: class="jep" -->
- Milling Project Coin <span>(5 enhancements)</span> <!-- .element: class="decent small" -->
[JEP 213](http://openjdk.java.net/jeps/213) <!-- .element: class="jep" -->
- Elide Deprecação de Warnings nas Declarações de Importações
[JEP 211](http://openjdk.java.net/jeps/211) <!-- .element: class="jep" -->
- Resolve Lint e Doclint Warnings
[JEP 212](http://openjdk.java.net/jeps/212) <!-- .element: class="jep" -->
</script>
</div>
</div>
</section>
<section>
<div data-markdown>
<script type="text/template">
#### E muito mais!
Acesse a lista completa no link http://openjdk.java.net/projects/jdk9/
</script>
</div>
</section>
</section>
</div>
</div>
<script src="presentation/lib/js/head.min.js"></script>
<script src="presentation/js/reveal.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
// Display controls in the bottom right corner
controls: true,
// Display a presentation progress bar
progress: true,
// Display the page number of the current slide
slideNumber: true,
// Push each slide change to the browser history
history: true,
// Enable keyboard shortcuts for navigation
keyboard: true,
// Enable the slide overview mode
overview: true,
// Vertical centering of slides
center: true,
// Enables touch navigation on devices with touch input
touch: true,
// Loop the presentation
loop: false,
// Change the presentation direction to be RTL
rtl: false,
// Turns fragments on and off globally
fragments: true,
// Flags if the presentation is running in an embedded mode,
// i.e. contained within a limited portion of the screen
embedded: false,
// Flags if we should show a help overlay when the questionmark
// key is pressed
help: true,
// Number of milliseconds between automatically proceeding to the
// next slide, disabled when set to 0, this value can be overwritten
// by using a data-autoslide attribute on your slides
autoSlide: 0,
// Stop auto-sliding after user input
autoSlideStoppable: true,
// Enable slide navigation via mouse wheel
mouseWheel: true,
// Hides the address bar on mobile devices
hideAddressBar: true,
// Opens links in an iframe preview overlay
previewLinks: false,
// Transition style
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Transition speed
transitionSpeed: 'default', // default/fast/slow
// Transition style for full page slide backgrounds
backgroundTransition: 'default', // none/fade/slide/convex/concave/zoom
// Number of slides away from the current that are visible
viewDistance: 3,
// Parallax background image
parallaxBackgroundImage: 'presentation/img/puzzle.jpg', // e.g. "'https://s3.amazonaws.com/hakim-static/reveal-js/reveal-parallax-1.jpg'"
// Parallax background size
parallaxBackgroundSize: '1600px 1200px', // CSS syntax, e.g. "2100px 900px"
// Amount to move parallax background (horizontal and vertical) on slide change
// Number, e.g. 100
parallaxBackgroundHorizontal: '',
parallaxBackgroundVertical: '',
// The "normal" size of the presentation, aspect ratio will be preserved
// when the presentation is scaled to fit different resolutions. Can be
// specified using percentage units.
width: 1280,
height: 720,
// Factor of the display size that should remain empty around the content
margin: 0.05,
// Bounds for smallest/largest possible scale to apply to content
minScale: 0.2,
maxScale: 1.5,
// Ctrl + Mouse-Click ==> Zoom in
zoomKey: 'ctrl',
// Optional reveal.js plugins
dependencies: [
{
src: 'presentation/lib/js/classList.js', condition: function () {
return !document.body.classList;
}
},
{
src: 'presentation/plugin/markdown/marked.js', condition: function () {
return !!document.querySelector('[data-markdown]');
}
},
{
src: 'presentation/plugin/markdown/markdown.js', condition: function () {
return !!document.querySelector('[data-markdown]');
}
},
{
src: 'presentation/plugin/highlight/highlight.js', async: true, condition: function () {
return true;
}, callback: function () {
hljs.initHighlightingOnLoad();
}
},
{src: 'presentation/plugin/zoom-js/zoom.js', async: true},
{src: 'presentation/plugin/notes/notes.js', async: true}
]
});
</script>
<script src="presentation/js/zepto.min.js"></script>
<script>
Zepto(function ($) {
var tableOfContents = $('#table-of-contents');
var tableList = $('<ol />')
$('.toc-element').each(function (index) {
var _self = $(this),
hash = '#/' + _self.closest('section').index();
if (_self.text()) {
tableList.append([
'<li>',
// '<a href="' + hash + '">',
_self.text(),
//'</a>',
'</li>'
].join(''));
}
});
tableOfContents.html(tableList);
});
</script>
</body>
</html>