SlideShare una empresa de Scribd logo
1 de 50
Descargar para leer sin conexión
@juanplopes




JAVA
       PARA
       PROGRAMADORES
       .NET
Rio de Janeiro
Bel' Zonte
Em comunidades,
pessoas antes de tecnologias.
REVELAÇÃO!
REVELAÇÃO!




https://github.com/juanplopes/mublasters
VAMOS FALAR
  MAL DE
SISTEMA DE TIPOS NÃO É
        UNIFICADO



    NÃO TEM STRUCTS




GENERICS TEM TYPE ERASURE
API DE DATAS SOFRÍVEL




 NÃO TEM ITERATOR METHODS




NÃO TEM CLOSURES OU LAMBDAS
java.util.concurrent
NÃO CRIE THREADS


new Thread(new Runnable() {
    public void run() {

    }
}).start();
TRABALHANDO COM FUTURES


Future é a promessa do resultado de
    uma computação que ainda não
   terminou (ou sequer começou).
TRABALHANDO COM FUTURES

ExecutorService executor = ...

Future future = executor.submit(new Runnable() {
    public void run() {

      }
});

//qualquer outro trabalho

future.get(); //bloqueante
TRABALHANDO COM FUTURES

ExecutorService executor = ...

Future<String> future = executor.submit(new Callable<String>()
{
    public String call() {
       return "42";
    }
});

//qualquer outro trabalho

String result = future.get(); //bloqueante
.NET TASK FACTORY

TaskFactory factory = ...

var task = factory.StartNew(() => "42");

//qualquer outro trabalho

String result = future.Result; //bloqueante
.NET TASK FACTORY


      Java 5 (2004)
ExecutorService e Future<T>

      .NET 4 (2010)
TaskFactory, TaskScheduler e
           Task<T>
TRABALHANDO COM FUTURES


Executors
   newCachedThreadPool()
   newFixedThreadPool(n)
   newScheduledThreadPool(n)
   newSingleThreadExecutor()

guava.MoreExecutors
   sameThreadExecutor()
   listeningDecorator(executor)
E A SINCRONIZAÇÃO?
COLEÇÕES CONCORRENTES


ConcurrentMap<T, K>

  putIfAbsent(key, value)
  remove(key, value)
  replace(key, value)
  replace(key, oldValue, newValue)
COLEÇÕES CONCORRENTES


ConcurrentNavigableMap<T, K>

  headMap(toKey)
  tailMap(fromKey)
  subMap(fromKey, toKey)
PROBLEMA DO PRODUTOR-
     CONSUMIDOR


     produz            consome



 A            BUFFER             B
COLEÇÕES BLOQUEANTES


ArrayBlockingQueue<T>,
PriorityBlockingQueue<T>
DelayQueue<T>

  Exception: add, remove
  Retorna Flag: offer, poll
  Bloqueia: put, take
  Timeout: offer², poll²
ESTRUTURAS DE DADOS DE
    SINCRONIZAÇÃO

Semaphore

  acquire(number)
  release(number)
ESTRUTURAS DE DADOS DE
    SINCRONIZAÇÃO

CountDownLatch

  countDown()
  await()
ESTRUTURAS DE DADOS DE
    SINCRONIZAÇÃO

CyclicBarrier

  await()
OPEN SOURCE
APACHE

         Hadoop
         Lucene
         Maven
         Tomcat
         ZooKeeper
         HBase
         Solr
         ActiveMQ
         Ant
         Log4J
RED HAT

          Hibernate
          JBoss
          TorqueBox
          JGroups
          Infinispan
          AeroGear
          Drools
          EJB3
          HornetQ
          RichFaces
GOOGLE

         Guava
         Guice ('Juice')
         Gson
         Protocol Buffers
         Contracts
         GWT
         Caliper
OPEN JDK
APACHE MAVEN

<dependency>
    <groupId>...</groupId>
    <artifactId>...</artifactId>
    <version>...</version>
</dependency>
APACHE MAVEN
JGROUPS

JChannel channel = new JChannel();
channel.setReceiver(new ReceiverAdapter() {
    public void receive(Message msg) {
        System.out.println(
            msg.getSrc() + ": " + msg.getObject());
    }
});

channel.connect("meuCanalDeChat");

BufferedReader reader = new BufferedReader(
                       new InputStreamReader(System.in));
while(true) {
   String line = reader.readLine();
   channel.send(null, line);
}
GUAVA

Preconditions
Immutable Collections
Caching
Functional Idioms
Signed Numbers
Reflection
Math
Optimized Data Structures
Simplified I/O
GUAVA

LoadingCache<Key, Graph> graphs = CacheBuilder.newBuilder()
    .maximumSize(1000)
    .expireAfterWrite(10, TimeUnit.MINUTES)
    .removalListener(MY_LISTENER)
    .build(new CacheLoader<Key, Graph>() {
        public Graph load(Key key) throws AnyException {
            return createExpensiveGraph(key);
        }
    });
GUICE ou SPRING?




É mais rápido             Mais usuários
Sem XML                    Não é só IOC
Menos Annotations        Integra melhor
Melhores convenções   Mais documentação
AOP embutido
MOCKITO


when(obj.method()).thenReturn(42);

verify(obj).method();
LINGUAGENS ALTERNATIVAS

●   JRuby
●   Clojure
●   Scala
●   Groovy
●   DynJS
IDE
IDEs
       IDE
HOTSPOT
JIT E ADAPTIVE OPTIMIZATION

Loop Unrolling
Method inlining
Exact Type Inference
Type Test Strength Reduction
Dead Code Elimination
Tiered Compilation
Lock Elision
Dereflection
Autobox Elimination
GC: CONCURRENT MARK SWEEP
JVISUALVM
JVISUALVM
YOURKIT PROFILER
Tecnologia não é religião,
time de futebol ou partido
         político.
Obrigado.

Más contenido relacionado

La actualidad más candente

Gevent what's the point
Gevent what's the pointGevent what's the point
Gevent what's the point
seanmcq
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoin
knight1128
 

La actualidad más candente (20)

Java 7 LavaJUG
Java 7 LavaJUGJava 7 LavaJUG
Java 7 LavaJUG
 
Understanding greenlet
Understanding greenletUnderstanding greenlet
Understanding greenlet
 
Gevent what's the point
Gevent what's the pointGevent what's the point
Gevent what's the point
 
Jenkins 2を使った究極のpipeline ~ 明日もう一度来てください、本物のpipelineをお見せしますよ ~
Jenkins 2を使った究極のpipeline ~ 明日もう一度来てください、本物のpipelineをお見せしますよ ~Jenkins 2を使った究極のpipeline ~ 明日もう一度来てください、本物のpipelineをお見せしますよ ~
Jenkins 2を使った究極のpipeline ~ 明日もう一度来てください、本物のpipelineをお見せしますよ ~
 
Jdk 7 4-forkjoin
Jdk 7 4-forkjoinJdk 7 4-forkjoin
Jdk 7 4-forkjoin
 
ESCMAScript 6: Get Ready For The Future. Now
ESCMAScript 6: Get Ready For The Future. NowESCMAScript 6: Get Ready For The Future. Now
ESCMAScript 6: Get Ready For The Future. Now
 
Oredev 2015 - Taming Java Agents
Oredev 2015 - Taming Java AgentsOredev 2015 - Taming Java Agents
Oredev 2015 - Taming Java Agents
 
RuntimeUnitTestToolkit for Unity(English)
RuntimeUnitTestToolkit for Unity(English)RuntimeUnitTestToolkit for Unity(English)
RuntimeUnitTestToolkit for Unity(English)
 
Memory Management of C# with Unity Native Collections
Memory Management of C# with Unity Native CollectionsMemory Management of C# with Unity Native Collections
Memory Management of C# with Unity Native Collections
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 
Java9を迎えた今こそ!Java本格(再)入門
Java9を迎えた今こそ!Java本格(再)入門Java9を迎えた今こそ!Java本格(再)入門
Java9を迎えた今こそ!Java本格(再)入門
 
DevoxxPL: JRebel Under The Covers
DevoxxPL: JRebel Under The CoversDevoxxPL: JRebel Under The Covers
DevoxxPL: JRebel Under The Covers
 
Testing with Node.js
Testing with Node.jsTesting with Node.js
Testing with Node.js
 
разработка серверов и серверных приложений лекция №4
разработка серверов и серверных приложений лекция №4разработка серверов и серверных приложений лекция №4
разработка серверов и серверных приложений лекция №4
 
Performance is a feature! - Developer South Coast - part 2
Performance is a feature!  - Developer South Coast - part 2Performance is a feature!  - Developer South Coast - part 2
Performance is a feature! - Developer South Coast - part 2
 
Qt Rest Server
Qt Rest ServerQt Rest Server
Qt Rest Server
 
Server1
Server1Server1
Server1
 
Is your profiler speaking the same language as you? -- Docklands JUG
Is your profiler speaking the same language as you? -- Docklands JUGIs your profiler speaking the same language as you? -- Docklands JUG
Is your profiler speaking the same language as you? -- Docklands JUG
 
Nantes Jug - Java 7
Nantes Jug - Java 7Nantes Jug - Java 7
Nantes Jug - Java 7
 
Spock: A Highly Logical Way To Test
Spock: A Highly Logical Way To TestSpock: A Highly Logical Way To Test
Spock: A Highly Logical Way To Test
 

Destacado

Gluster open stack dev summit 042011
Gluster open stack dev summit 042011Gluster open stack dev summit 042011
Gluster open stack dev summit 042011
Open Stack
 
Do you really get class loaders?
Do you really get class loaders? Do you really get class loaders?
Do you really get class loaders?
guestd56374
 
Secrets of a successful e-commerce website
Secrets of a successful e-commerce websiteSecrets of a successful e-commerce website
Secrets of a successful e-commerce website
Troy Cox
 
KG이니시스 회사 소개서
KG이니시스 회사 소개서KG이니시스 회사 소개서
KG이니시스 회사 소개서
Inicis
 

Destacado (20)

Guía completa de linkbuilding - La visión más realista
Guía completa de linkbuilding - La visión más realistaGuía completa de linkbuilding - La visión más realista
Guía completa de linkbuilding - La visión más realista
 
Gluster open stack dev summit 042011
Gluster open stack dev summit 042011Gluster open stack dev summit 042011
Gluster open stack dev summit 042011
 
产品经理的视角
产品经理的视角产品经理的视角
产品经理的视角
 
Do you really get class loaders?
Do you really get class loaders? Do you really get class loaders?
Do you really get class loaders?
 
On The Road
On The RoadOn The Road
On The Road
 
CEO Survey 2014 - Poimintoja Suomen tuloksista
CEO Survey 2014 - Poimintoja Suomen tuloksistaCEO Survey 2014 - Poimintoja Suomen tuloksista
CEO Survey 2014 - Poimintoja Suomen tuloksista
 
After Real Time Advertising
After Real Time AdvertisingAfter Real Time Advertising
After Real Time Advertising
 
Why APIs are not SOA++
Why APIs are not SOA++Why APIs are not SOA++
Why APIs are not SOA++
 
Emagineers - Design & Test Report
Emagineers - Design & Test ReportEmagineers - Design & Test Report
Emagineers - Design & Test Report
 
Mobile Device Management: Securing your Mobile Environment.
Mobile Device Management: Securing your Mobile Environment.Mobile Device Management: Securing your Mobile Environment.
Mobile Device Management: Securing your Mobile Environment.
 
5050 project update
5050 project update5050 project update
5050 project update
 
Dependency injection in scala
Dependency injection in scalaDependency injection in scala
Dependency injection in scala
 
Editorial Strategy: The Missing Link in Civic Data Tools, Transparency Camp 2015
Editorial Strategy: The Missing Link in Civic Data Tools, Transparency Camp 2015Editorial Strategy: The Missing Link in Civic Data Tools, Transparency Camp 2015
Editorial Strategy: The Missing Link in Civic Data Tools, Transparency Camp 2015
 
Secrets of a successful e-commerce website
Secrets of a successful e-commerce websiteSecrets of a successful e-commerce website
Secrets of a successful e-commerce website
 
Four Country Mobile Operator Study: a competitive benchmark of leading mobile...
Four Country Mobile Operator Study: a competitive benchmark of leading mobile...Four Country Mobile Operator Study: a competitive benchmark of leading mobile...
Four Country Mobile Operator Study: a competitive benchmark of leading mobile...
 
High Performance Web Sites
High Performance Web SitesHigh Performance Web Sites
High Performance Web Sites
 
Raymond - Social Media Strategy
Raymond - Social Media StrategyRaymond - Social Media Strategy
Raymond - Social Media Strategy
 
KG이니시스 회사 소개서
KG이니시스 회사 소개서KG이니시스 회사 소개서
KG이니시스 회사 소개서
 
Embrace Uncertainty
Embrace UncertaintyEmbrace Uncertainty
Embrace Uncertainty
 
2015 WebConf - Web + Arduino 實在有夠潮
2015 WebConf  - Web + Arduino 實在有夠潮2015 WebConf  - Web + Arduino 實在有夠潮
2015 WebConf - Web + Arduino 實在有夠潮
 

Similar a devday2012

JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
David Padbury
 
Clojure - A new Lisp
Clojure - A new LispClojure - A new Lisp
Clojure - A new Lisp
elliando dias
 

Similar a devday2012 (20)

4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
4Developers 2015: Programowanie synchroniczne i asynchroniczne - dwa światy k...
 
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
 
RxJS101 - What you need to know to get started with RxJS tomorrow
RxJS101 - What you need to know to get started with RxJS tomorrowRxJS101 - What you need to know to get started with RxJS tomorrow
RxJS101 - What you need to know to get started with RxJS tomorrow
 
Auto-GWT : Better GWT Programming with Xtend
Auto-GWT : Better GWT Programming with XtendAuto-GWT : Better GWT Programming with Xtend
Auto-GWT : Better GWT Programming with Xtend
 
JavaScript Growing Up
JavaScript Growing UpJavaScript Growing Up
JavaScript Growing Up
 
Silicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM MechanicsSilicon Valley JUG: JVM Mechanics
Silicon Valley JUG: JVM Mechanics
 
Clojure - A new Lisp
Clojure - A new LispClojure - A new Lisp
Clojure - A new Lisp
 
JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?JVM Mechanics: When Does the JVM JIT & Deoptimize?
JVM Mechanics: When Does the JVM JIT & Deoptimize?
 
OSGi and Eclipse RCP
OSGi and Eclipse RCPOSGi and Eclipse RCP
OSGi and Eclipse RCP
 
Java Concurrency
Java ConcurrencyJava Concurrency
Java Concurrency
 
Building Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJavaBuilding Scalable Stateless Applications with RxJava
Building Scalable Stateless Applications with RxJava
 
RxJava applied [JavaDay Kyiv 2016]
RxJava applied [JavaDay Kyiv 2016]RxJava applied [JavaDay Kyiv 2016]
RxJava applied [JavaDay Kyiv 2016]
 
Java util concurrent
Java util concurrentJava util concurrent
Java util concurrent
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
From Java 6 to Java 7 reference
From Java 6 to Java 7 referenceFrom Java 6 to Java 7 reference
From Java 6 to Java 7 reference
 
What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)What can be done with Java, but should better be done with Erlang (@pavlobaron)
What can be done with Java, but should better be done with Erlang (@pavlobaron)
 
wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?wtf is in Java/JDK/wtf7?
wtf is in Java/JDK/wtf7?
 
What is new in java 8 concurrency
What is new in java 8 concurrencyWhat is new in java 8 concurrency
What is new in java 8 concurrency
 
JS everywhere 2011
JS everywhere 2011JS everywhere 2011
JS everywhere 2011
 
Java 7 & 8 New Features
Java 7 & 8 New FeaturesJava 7 & 8 New Features
Java 7 & 8 New Features
 

Más de Juan Lopes (10)

qconrio2015
qconrio2015qconrio2015
qconrio2015
 
qconsp2015
qconsp2015qconsp2015
qconsp2015
 
PIPES: Uma linguagem para processamento distribuído de eventos complexos
PIPES: Uma linguagem para processamento distribuído de eventos complexosPIPES: Uma linguagem para processamento distribuído de eventos complexos
PIPES: Uma linguagem para processamento distribuído de eventos complexos
 
devday2013
devday2013devday2013
devday2013
 
dnarj20130504
dnarj20130504dnarj20130504
dnarj20130504
 
uerj201212
uerj201212uerj201212
uerj201212
 
rioinfo2012
rioinfo2012rioinfo2012
rioinfo2012
 
tdc2012
tdc2012tdc2012
tdc2012
 
dnarj-20120630
dnarj-20120630dnarj-20120630
dnarj-20120630
 
dnad12
dnad12dnad12
dnad12
 

Último

Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Último (20)

Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
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
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
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
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
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...
 
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
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 

devday2012