Você está na página 1de 43

JVMdoJava8

dedentroprafora

MarioAmaral
@mario_fts
github.com/mariofts

Quemsoueu?
MrioAmaral
Instrutor e Desenvolvedor
Caelum Stella
Vraptor

JVMdoJava8
dedentroprafora

ModularizaodaJVM
NovaEnginedeJs
MudanasnaMemria
Oqueficoudefora...

Modulariza
o da JVM

TamanhodaJVM

~140MB

Dispositivos
menores

Arduino

BeagleBoard

Raspberry Pi

CompactProfiles
4profilesdefault

Compact1
Core
Date&Time
Collections
...

Compact2
Compact1
JDBC
Jax-P

Compact3
Compact3
Security
JMX

FUllSE
Compact3
Swing
Jax-WS
Resto...

10 MB
compact1
17 MB
compact2

24 MB
compact3

140 MB
Full jre

Nova VM de
JavaScript

PERA...

Dprarodarjavascriptde
dentrodaJVM?

SIM

Rhino

Mozilla
Java6
Compilajsparabytecode

Naverdade...
Vriaslinguagens

Java7

invokedynamic

Nashorn

Oracle
Java8
Compilajsparabytecode
Usanovasfeatures

hello.js
var hello = function() {
print("Hello Nashorn!");
};
hello();

noterminal...
$ jjs hello.js
Hello Nashorn!
$

Nojava....
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine engine = manager.getEngineByName("nashorn");
engine.eval("hello.js");

Mudanas
na Memria

MemriadoJavamodular

PermGen

Objetos"permanentes"
MetadadosdeClasses
Ref.estticas
PooldeStrings

OProblema...

Nemtudopermanente...
OutOfMemoryError:PermGen
Space

MetaSpace
MemriaNativa
Dinmico

Nuncamais
OutOfMemoryError:PermGenSpace

Mas..

Mas..
OutOfMemoryError:MetadataSpace

TamanhodoMetaSpace
configurvel
-XX:MetaspaceSize
-XX:MaxMetaspaceSize

Eofuturo?

JigSaw

Modularizao
FimdoJarHell

jdeps

Comandoparamostrar
dependnciaentrejars

jdeps -cp * vraptor-4.0.1-SNAPSHOT.jar

vraptor-4.0.0.Final.jar -> xstream-1.4.7.jar


vraptor-4.0.0.Final.jar -> javassist-3.18.1-GA.jar
vraptor-4.0.0.Final.jar -> iogi-1.0.0.jar
vraptor-4.0.0.Final.jar -> commons-io-2.2.jar
vraptor-4.0.0.Final.jar -> paranamer-2.6.jar
vraptor-4.0.0.Final.jar -> jstl-1.2.jar
vraptor-4.0.0.Final.jar -> javax.annotation-api-1.2.jar
vraptor-4.0.0.Final.jar -> mirror-1.6.1.jar
vraptor-4.0.0.Final.jar -> gson-2.2.4.jar
vraptor-4.0.0.Final.jar -> slf4j-api-1.7.5.jar
vraptor-4.0.0.Final.jar -> validation-api-1.1.0.Final.jar
vraptor-4.0.0.Final.jar -> javax.interceptor-api-1.2.jar
vraptor-4.0.0.Final.jar -> weld-core-impl-2.1.2.Final.jar
vraptor-4.0.0.Final.jar -> javax.ejb-api-3.2.jar
vraptor-4.0.0.Final.jar -> guava-15.0.jar
vraptor-4.0.0.Final.jar -> jdk1.8.0_05.jdk/Contents/Home/jre/lib/rt.ja
vraptor-4.0.0.Final.jar -> javax.inject-1.jar
vraptor-4.0.0.Final.jar -> javax.servlet-api-3.1.0.jar
vraptor-4.0.0.Final.jar -> commons-fileupload-1.3.1.jar
vraptor-4.0.0.Final.jar -> cdi-api-1.1.jar

Referncias
Oracle: what's new
Compact profiles overview
Mais sobre compact profiles
Post sobre o Nashorn
Permgem vs. Metaspace

JVMdoJava8
dedentroprafora

MarioAmaral
@mario_fts
github.com/mariofts