SlideShare a Scribd company logo
1 of 36
Download to read offline
The WGJD - Intro to Java 7
                           Ben Evans and Martijn Verburg
                              (@kittylyst @karianna)

                               http://www.teamsparq.net


                           Slide Design by http://www.kerrykenneally.com


Saturday, 24 December 11                                                   1
This is not an Oracle legal slide




                                          2


Saturday, 24 December 11                        2
No, we’re not in sales!


     • Directors of TeamSparq
           – “Optimisation for Technical Teams”
           – Ben is known for his performance & concurrency work
           – Martijn is the “Diabolical Developer” and Ben can be just as ‘evil’


     • Authors of “The Well-Grounded Java Developer”

     • Co-Leaders of the LJC (London’s Java User Group)
           – Hold a seat on the JCP SE/EE Executive Committee

     • Regular conference speakers
           – JavaOne, Devoxx, OSCON, etc



                                                                              3


Saturday, 24 December 11                                                           3
Who are these two anyway?




                                                4


Saturday, 24 December 11                            4
How this university session is going to work


     • This is a fact!
           – This is an opinion


     • This session may be a little different to advertised...
           – Being a “Well-Grounded Java Developer” changes over time

     • This session will go fairly quickly
           – But the slides will be made available
           – And you can always get hold of us for any questions




                                                                        5


Saturday, 24 December 11                                                    5
Timetable


     • Introduction to Java 7 (~35 mins)

     • BREAK (5 minutes)

     • Polyglot and functional programming (~50 mins)

     • BREAK (5 minutes)

     • Modern Java Concurrency (~60 mins)

     • Conclusion and Extra Q&A



                                                        6


Saturday, 24 December 11                                    6
Real Developers code through
                    bathroom breaks




                                       7


Saturday, 24 December 11                    7
The Well-Grounded Java Developer...


     • Is not just a Java language whizz
           –   Understands the basics of the JVM
           –   Understands software development is a social activity
           –   Utilises software craftsmanship approaches
           –   Understands architecture


     • Is looking at Java 7
     •
     • Is looking at polyglot and functional programming

     • Is looking at modern concurrency practices




                                                                       8


Saturday, 24 December 11                                                   8
Java 7 - Why is it important


     • The WGJD wants to code rapidly

     • The WGJD wants to code concisely

     • The WGJD wants to take advantage of:
           – The compiler (including JIT)
           – The JVM


     • Java 7 gives you many improvements in these areas




                                                           9


Saturday, 24 December 11                                       9
OpenJDK - The Java 7/8 split


     • 20 Sep 2010 - Mark Reinhold announces Plan B
           – Splits OpenJDK effort into Java 7 (July 2011) and Java 8 (2013)
           – Popular choice with the community

     • July 2011 - Java 7 goes gold

     • Some new features to be delayed until JDK 8
           – Closures Lambdas SAM literals
           – Modularisation (aka Jigsaw)

     • JRockit features to be merged into OpenJDK
           – Enhanced management of the JVM
           – Ongoing merge of the VM engineering groups


                                                                          10


Saturday, 24 December 11                                                       10
Contents of JDK 7 Release


     • Project Coin

     • NIO.2

     • Method Handles

     • invokedynamic

     • Concurrency Refresh

     • Odds & Ends



                                                11


Saturday, 24 December 11                             11
Project Coin


     • “Small” changes

     • Language Level, not VM

     • Stay away from the type system

     • Developed in a very OSS manner
           – Was an ‘interesting’ experience for all involved




                                                                12


Saturday, 24 December 11                                             12
Project Coin - Highlights


     • Strings in switch


     • try-with-resources (aka ARM or TWR)

     • Diamond Syntax

     • Multicatch with precise rethrow

     • Enhanced syntax for numeric literals

     • Varargs / autoboxing warning



                                                13


Saturday, 24 December 11                             13
Strings in switch




     • Code along exercise: FeedingSchedule.java



                                                   14


Saturday, 24 December 11                                14
try-with-resources




                                         15


Saturday, 24 December 11                      15
Diamond syntax




     • Code along exercise: HordeOfOtters.java



                                                 16


Saturday, 24 December 11                              16
Personally I’d stick to Java 1.4




                                          17


Saturday, 24 December 11                        17
NIO.2 - New I/O version 2


     • A new file system and path abstraction

     • Based on Path
           – An abstract view of a ‘file like’ system

     • Files class contains many helper methods, including
           – File manipulation (copy, move, rename etc)
           – Walking directory trees
           – Native file system support (e.g. symbolic links)

     • Works with existing java.io.File code




                                                                18


Saturday, 24 December 11                                             18
NIO.2 - New I/O version 2


     • Asynchronous (non-blocking) I/O

     • For sockets and files

     • Mainly utilises java.util.concurrent.Future

     • New NetworkChannel
           – Socket/Channel construct
           – Binding, options and multicast




                                                     19


Saturday, 24 December 11                                  19
Path and Files - Some examples




     • Code along exercise: Housekeeping.java



                                                     20


Saturday, 24 December 11                                  20
URL stream to file - Java 6 style NIO




                                                            21


Saturday, 24 December 11                                         21
URL stream to file in Java 7




     • Code along exercise: VetNotes.java



                                                   22


Saturday, 24 December 11                                22
NIO.2 - Future base file I/O




                                                   23


Saturday, 24 December 11                                23
Monty Python eat your heart out




                                       24


Saturday, 24 December 11                     24
Method Handles


     • We already have Reflection API
           – It’s all pretty horrible

     • JDK 7 introduces a new way to inspect at runtime

     • Method Handles
           – Represent the ability to call a method
           – Implement a subclass of java.lang.invoke.MethodHandle
           – Are strongly-typed and typesafe
           – Needed for invokedynamic - but also used standalone




                                                                   25


Saturday, 24 December 11                                                25
Example - ThreadPoolManager




                                                  26


Saturday, 24 December 11                               26
Cancelling using Reflection




                                                  27


Saturday, 24 December 11                               27
Cancelling using MethodHandle




                                                    28


Saturday, 24 December 11                                 28
invokedynamic


     • invokedynamic is a key new JVM feature
           – It’s the first new bytecode since Java 1.0
           – Joins invokevirtual, invokestatic, invokeinterface and
             invokespecial


     • Relaxes a key part of the static typing system
           – User code can determine dispatch at runtime

     • Aims to be as fast as regular method dispatch
           – e.g. invokevirtual


     • No Java syntax in Java 7
           – But maybe for Java 8


                                                               29


Saturday, 24 December 11                                              29
invokedynamic contd.


     • JRuby, Jython, Groovy, Clojure et al all benefit
           – JRuby gains a lot, Clojure not so much
           – Even Scala is using it now!

     • JRuby has been working closely with the JSR-292 team
           – Big wins
           – Makes JRuby enticing to Ruby developers

     • Java 8 also gets a boost
           – Lambdas have a much nicer design with invokedynamic




                                                                   30


Saturday, 24 December 11                                                30
Other JVM Languages?
           Meh - Use the Golden Hammer!




                                              31


Saturday, 24 December 11                           31
Java 7 Concurrency Refresh


     • Java 7 has a number of new concurrency toys

     • The headline item is Fork / Join
           – similar to MapReduce, useful for a certain class of problems
           – fork and join executions are not necessarily threads

     • We’ll cover this in the final hour!




                                                                            32


Saturday, 24 December 11                                                         32
Java 7 - That’s not all


     • Nimbus Look & Feel for Swing

     • New helper classes including Objects
           – .deepEquals() and friends


     • Enhanced JDBC (including try-with-resources support)

     • Better unicode support
           – Thanks in part to Tom Christiansen of Perl fame

     • More small changes in niche areas



                                                               33


Saturday, 24 December 11                                            33
New Faces in the OpenJDK




                                                            34
                                               Original Image by Acaben
Saturday, 24 December 11                                                  34
What We Didn’t Have Time To Talk About


     • Java 8
           – Java FX 2.0


     • Java EE 6/7

     • Java ME
           – Android and _that_ lawsuit


     • OpenJDK changes & JDK Enhancement Proposals (JEP)

     • Java Community Process (JCP)
           – Java Specification Requests (JSRs)
           – Java User Groups (JUGs) and reinvigorating the Community

                                                                        35


Saturday, 24 December 11                                                     35
What? You still here?
                      Go take a break will you!




                                                   36


Saturday, 24 December 11                                36

More Related Content

What's hot

Paperwork, Politics and Pain - Our year in the JCP (FOSDEM 2012)
Paperwork, Politics and Pain - Our year in the JCP (FOSDEM 2012)Paperwork, Politics and Pain - Our year in the JCP (FOSDEM 2012)
Paperwork, Politics and Pain - Our year in the JCP (FOSDEM 2012)Martijn Verburg
 
A Global In-memory Data System for MySQL
A Global In-memory Data System for MySQLA Global In-memory Data System for MySQL
A Global In-memory Data System for MySQLDaniel Austin
 
Enterprise javascriptsession2
Enterprise javascriptsession2Enterprise javascriptsession2
Enterprise javascriptsession2Troy Miles
 
Concurrency and Multithreading Demistified - Reversim Summit 2014
Concurrency and Multithreading Demistified - Reversim Summit 2014Concurrency and Multithreading Demistified - Reversim Summit 2014
Concurrency and Multithreading Demistified - Reversim Summit 2014Haim Yadid
 
02 introductionto java
02 introductionto java02 introductionto java
02 introductionto javaAPU
 
What Drove Wordnik Non-Relational?
What Drove Wordnik Non-Relational?What Drove Wordnik Non-Relational?
What Drove Wordnik Non-Relational?DATAVERSITY
 
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRicard Clau
 
Yes sql08 inmemorydb
Yes sql08 inmemorydbYes sql08 inmemorydb
Yes sql08 inmemorydbDaniel Austin
 
Stig: Social Graphs & Discovery at Scale
Stig: Social Graphs & Discovery at ScaleStig: Social Graphs & Discovery at Scale
Stig: Social Graphs & Discovery at ScaleDATAVERSITY
 
Stardog 1.1: An Easier, Smarter, Faster RDF Database
Stardog 1.1: An Easier, Smarter, Faster RDF DatabaseStardog 1.1: An Easier, Smarter, Faster RDF Database
Stardog 1.1: An Easier, Smarter, Faster RDF Databasekendallclark
 
Profiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty DetailsProfiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty DetailsAchievers Tech
 
Enterprise OSGi at eBay
Enterprise OSGi at eBayEnterprise OSGi at eBay
Enterprise OSGi at eBayTony Ng
 

What's hot (16)

Paperwork, Politics and Pain - Our year in the JCP (FOSDEM 2012)
Paperwork, Politics and Pain - Our year in the JCP (FOSDEM 2012)Paperwork, Politics and Pain - Our year in the JCP (FOSDEM 2012)
Paperwork, Politics and Pain - Our year in the JCP (FOSDEM 2012)
 
Devoxx Java Social and Agorava
Devoxx Java Social and AgoravaDevoxx Java Social and Agorava
Devoxx Java Social and Agorava
 
A Global In-memory Data System for MySQL
A Global In-memory Data System for MySQLA Global In-memory Data System for MySQL
A Global In-memory Data System for MySQL
 
Enterprise javascriptsession2
Enterprise javascriptsession2Enterprise javascriptsession2
Enterprise javascriptsession2
 
Concurrency and Multithreading Demistified - Reversim Summit 2014
Concurrency and Multithreading Demistified - Reversim Summit 2014Concurrency and Multithreading Demistified - Reversim Summit 2014
Concurrency and Multithreading Demistified - Reversim Summit 2014
 
02 introductionto java
02 introductionto java02 introductionto java
02 introductionto java
 
What Drove Wordnik Non-Relational?
What Drove Wordnik Non-Relational?What Drove Wordnik Non-Relational?
What Drove Wordnik Non-Relational?
 
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHP
 
Yes sql08 inmemorydb
Yes sql08 inmemorydbYes sql08 inmemorydb
Yes sql08 inmemorydb
 
Stig: Social Graphs & Discovery at Scale
Stig: Social Graphs & Discovery at ScaleStig: Social Graphs & Discovery at Scale
Stig: Social Graphs & Discovery at Scale
 
Stardog 1.1: An Easier, Smarter, Faster RDF Database
Stardog 1.1: An Easier, Smarter, Faster RDF DatabaseStardog 1.1: An Easier, Smarter, Faster RDF Database
Stardog 1.1: An Easier, Smarter, Faster RDF Database
 
Profiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty DetailsProfiling and Tuning a Web Application - The Dirty Details
Profiling and Tuning a Web Application - The Dirty Details
 
JavaEE 6 tools coverage
JavaEE 6 tools coverageJavaEE 6 tools coverage
JavaEE 6 tools coverage
 
Enterprise OSGi at eBay
Enterprise OSGi at eBayEnterprise OSGi at eBay
Enterprise OSGi at eBay
 
L1 basics
L1 basicsL1 basics
L1 basics
 
GWT-Basics
GWT-BasicsGWT-Basics
GWT-Basics
 

Viewers also liked

JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011Charles Nutter
 
Invokedynamic in 45 Minutes
Invokedynamic in 45 MinutesInvokedynamic in 45 Minutes
Invokedynamic in 45 MinutesCharles Nutter
 
JavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for DummiesJavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for DummiesCharles Nutter
 
JavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesJavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesCharles Nutter
 
Down the Rabbit Hole: An Adventure in JVM Wonderland
Down the Rabbit Hole: An Adventure in JVM WonderlandDown the Rabbit Hole: An Adventure in JVM Wonderland
Down the Rabbit Hole: An Adventure in JVM WonderlandCharles Nutter
 

Viewers also liked (6)

JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011JVM for Dummies - OSCON 2011
JVM for Dummies - OSCON 2011
 
Invokedynamic in 45 Minutes
Invokedynamic in 45 MinutesInvokedynamic in 45 Minutes
Invokedynamic in 45 Minutes
 
JavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for DummiesJavaOne 2012 - JVM JIT for Dummies
JavaOne 2012 - JVM JIT for Dummies
 
Down the Rabbit Hole
Down the Rabbit HoleDown the Rabbit Hole
Down the Rabbit Hole
 
JavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for DummiesJavaOne 2011 - JVM Bytecode for Dummies
JavaOne 2011 - JVM Bytecode for Dummies
 
Down the Rabbit Hole: An Adventure in JVM Wonderland
Down the Rabbit Hole: An Adventure in JVM WonderlandDown the Rabbit Hole: An Adventure in JVM Wonderland
Down the Rabbit Hole: An Adventure in JVM Wonderland
 

Similar to Intro to Java 7

Java Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.EasyJava Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.Easyroialdaag
 
Java for XPages Development
Java for XPages DevelopmentJava for XPages Development
Java for XPages DevelopmentTeamstudio
 
Tips For Maintaining OSS Projects
Tips For Maintaining OSS ProjectsTips For Maintaining OSS Projects
Tips For Maintaining OSS ProjectsTaro L. Saito
 
Openstack In Real Life
Openstack In Real LifeOpenstack In Real Life
Openstack In Real LifePaul Guth
 
How Class Data Sharing Can Speed up Your Jakarta EE Application Startup
How Class Data Sharing Can Speed up Your Jakarta EE Application StartupHow Class Data Sharing Can Speed up Your Jakarta EE Application Startup
How Class Data Sharing Can Speed up Your Jakarta EE Application StartupRudy De Busscher
 
Polyglot Plugin Programming
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin ProgrammingAtlassian
 
Introducing Hibernate OGM: porting JPA applications to NoSQL, Sanne Grinovero...
Introducing Hibernate OGM: porting JPA applications to NoSQL, Sanne Grinovero...Introducing Hibernate OGM: porting JPA applications to NoSQL, Sanne Grinovero...
Introducing Hibernate OGM: porting JPA applications to NoSQL, Sanne Grinovero...OpenBlend society
 
OSGi Community Event 2010 - OSGi and Android
OSGi Community Event 2010 - OSGi and AndroidOSGi Community Event 2010 - OSGi and Android
OSGi Community Event 2010 - OSGi and Androidmfrancis
 
The architecture of oak
The architecture of oakThe architecture of oak
The architecture of oakMichael Dürig
 
Ron Broersma dren-stavanger-22 nov2011
Ron Broersma dren-stavanger-22 nov2011Ron Broersma dren-stavanger-22 nov2011
Ron Broersma dren-stavanger-22 nov2011IPv6no
 
Enterprise javascriptsession1
Enterprise javascriptsession1Enterprise javascriptsession1
Enterprise javascriptsession1Troy Miles
 
Principles Of Programing Languages
Principles Of Programing LanguagesPrinciples Of Programing Languages
Principles Of Programing LanguagesMatthew McCullough
 
Splunking the JVM (Java Virtual Machine)
Splunking the JVM (Java Virtual Machine)Splunking the JVM (Java Virtual Machine)
Splunking the JVM (Java Virtual Machine)Damien Dallimore
 
01-Introduction.ppt
01-Introduction.ppt01-Introduction.ppt
01-Introduction.pptEmanAsem4
 
Gradle.Enemy at the gates
Gradle.Enemy at the gatesGradle.Enemy at the gates
Gradle.Enemy at the gatesStrannik_2013
 

Similar to Intro to Java 7 (20)

My sql tutorial-oscon-2012
My sql tutorial-oscon-2012My sql tutorial-oscon-2012
My sql tutorial-oscon-2012
 
Iwmn architecture
Iwmn architectureIwmn architecture
Iwmn architecture
 
Java Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.EasyJava Edge.2009.Grails.Web.Dev.Made.Easy
Java Edge.2009.Grails.Web.Dev.Made.Easy
 
Java for XPages Development
Java for XPages DevelopmentJava for XPages Development
Java for XPages Development
 
Tips For Maintaining OSS Projects
Tips For Maintaining OSS ProjectsTips For Maintaining OSS Projects
Tips For Maintaining OSS Projects
 
Openstack In Real Life
Openstack In Real LifeOpenstack In Real Life
Openstack In Real Life
 
How Class Data Sharing Can Speed up Your Jakarta EE Application Startup
How Class Data Sharing Can Speed up Your Jakarta EE Application StartupHow Class Data Sharing Can Speed up Your Jakarta EE Application Startup
How Class Data Sharing Can Speed up Your Jakarta EE Application Startup
 
Polyglot Plugin Programming
Polyglot Plugin ProgrammingPolyglot Plugin Programming
Polyglot Plugin Programming
 
Introducing Hibernate OGM: porting JPA applications to NoSQL, Sanne Grinovero...
Introducing Hibernate OGM: porting JPA applications to NoSQL, Sanne Grinovero...Introducing Hibernate OGM: porting JPA applications to NoSQL, Sanne Grinovero...
Introducing Hibernate OGM: porting JPA applications to NoSQL, Sanne Grinovero...
 
Polyglot Grails
Polyglot GrailsPolyglot Grails
Polyglot Grails
 
OSGi Community Event 2010 - OSGi and Android
OSGi Community Event 2010 - OSGi and AndroidOSGi Community Event 2010 - OSGi and Android
OSGi Community Event 2010 - OSGi and Android
 
Scalability
ScalabilityScalability
Scalability
 
The architecture of oak
The architecture of oakThe architecture of oak
The architecture of oak
 
Ron Broersma dren-stavanger-22 nov2011
Ron Broersma dren-stavanger-22 nov2011Ron Broersma dren-stavanger-22 nov2011
Ron Broersma dren-stavanger-22 nov2011
 
Enterprise javascriptsession1
Enterprise javascriptsession1Enterprise javascriptsession1
Enterprise javascriptsession1
 
Principles Of Programing Languages
Principles Of Programing LanguagesPrinciples Of Programing Languages
Principles Of Programing Languages
 
Splunking the JVM (Java Virtual Machine)
Splunking the JVM (Java Virtual Machine)Splunking the JVM (Java Virtual Machine)
Splunking the JVM (Java Virtual Machine)
 
01-Introduction.ppt
01-Introduction.ppt01-Introduction.ppt
01-Introduction.ppt
 
HTML5 and Sencha Touch
HTML5 and Sencha TouchHTML5 and Sencha Touch
HTML5 and Sencha Touch
 
Gradle.Enemy at the gates
Gradle.Enemy at the gatesGradle.Enemy at the gates
Gradle.Enemy at the gates
 

More from Martijn Verburg

Garbage Collection - The Useful Parts
Garbage Collection - The Useful PartsGarbage Collection - The Useful Parts
Garbage Collection - The Useful PartsMartijn Verburg
 
Modern software development anti patterns (OSCON 2012)
Modern software development anti patterns (OSCON 2012)Modern software development anti patterns (OSCON 2012)
Modern software development anti patterns (OSCON 2012)Martijn Verburg
 
Modern Java Concurrency (Devoxx Nov/2011)
Modern Java Concurrency (Devoxx Nov/2011)Modern Java Concurrency (Devoxx Nov/2011)
Modern Java Concurrency (Devoxx Nov/2011)Martijn Verburg
 
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Martijn Verburg
 
How to open source a project at Mega Corp (Geecon - May/2011)
How to open source a project at Mega Corp (Geecon - May/2011)How to open source a project at Mega Corp (Geecon - May/2011)
How to open source a project at Mega Corp (Geecon - May/2011)Martijn Verburg
 
Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Martijn Verburg
 

More from Martijn Verburg (7)

NoHR Hiring
NoHR HiringNoHR Hiring
NoHR Hiring
 
Garbage Collection - The Useful Parts
Garbage Collection - The Useful PartsGarbage Collection - The Useful Parts
Garbage Collection - The Useful Parts
 
Modern software development anti patterns (OSCON 2012)
Modern software development anti patterns (OSCON 2012)Modern software development anti patterns (OSCON 2012)
Modern software development anti patterns (OSCON 2012)
 
Modern Java Concurrency (Devoxx Nov/2011)
Modern Java Concurrency (Devoxx Nov/2011)Modern Java Concurrency (Devoxx Nov/2011)
Modern Java Concurrency (Devoxx Nov/2011)
 
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)
 
How to open source a project at Mega Corp (Geecon - May/2011)
How to open source a project at Mega Corp (Geecon - May/2011)How to open source a project at Mega Corp (Geecon - May/2011)
How to open source a project at Mega Corp (Geecon - May/2011)
 
Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2Java 7 - short intro to NIO.2
Java 7 - short intro to NIO.2
 

Recently uploaded

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...Wes McKinney
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Karmanjay Verma
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Mark Simos
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentMahmoud Rabie
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesThousandEyes
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfAarwolf Industries LLC
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFMichael Gough
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxAna-Maria Mihalceanu
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024TopCSSGallery
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Jeffrey Haguewood
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 

Recently uploaded (20)

The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
The Future Roadmap for the Composable Data Stack - Wes McKinney - Data Counci...
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#Microservices, Docker deploy and Microservices source code in C#
Microservices, Docker deploy and Microservices source code in C#
 
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
Tampa BSides - The No BS SOC (slides from April 6, 2024 talk)
 
Digital Tools & AI in Career Development
Digital Tools & AI in Career DevelopmentDigital Tools & AI in Career Development
Digital Tools & AI in Career Development
 
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyesAssure Ecommerce and Retail Operations Uptime with ThousandEyes
Assure Ecommerce and Retail Operations Uptime with ThousandEyes
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Landscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdfLandscape Catalogue 2024 Australia-1.pdf
Landscape Catalogue 2024 Australia-1.pdf
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
All These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDFAll These Sophisticated Attacks, Can We Really Detect Them - PDF
All These Sophisticated Attacks, Can We Really Detect Them - PDF
 
A Glance At The Java Performance Toolbox
A Glance At The Java Performance ToolboxA Glance At The Java Performance Toolbox
A Glance At The Java Performance Toolbox
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024Top 10 Hubspot Development Companies in 2024
Top 10 Hubspot Development Companies in 2024
 
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
Email Marketing Automation for Bonterra Impact Management (fka Social Solutio...
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 

Intro to Java 7

  • 1. The WGJD - Intro to Java 7 Ben Evans and Martijn Verburg (@kittylyst @karianna) http://www.teamsparq.net Slide Design by http://www.kerrykenneally.com Saturday, 24 December 11 1
  • 2. This is not an Oracle legal slide 2 Saturday, 24 December 11 2
  • 3. No, we’re not in sales! • Directors of TeamSparq – “Optimisation for Technical Teams” – Ben is known for his performance & concurrency work – Martijn is the “Diabolical Developer” and Ben can be just as ‘evil’ • Authors of “The Well-Grounded Java Developer” • Co-Leaders of the LJC (London’s Java User Group) – Hold a seat on the JCP SE/EE Executive Committee • Regular conference speakers – JavaOne, Devoxx, OSCON, etc 3 Saturday, 24 December 11 3
  • 4. Who are these two anyway? 4 Saturday, 24 December 11 4
  • 5. How this university session is going to work • This is a fact! – This is an opinion • This session may be a little different to advertised... – Being a “Well-Grounded Java Developer” changes over time • This session will go fairly quickly – But the slides will be made available – And you can always get hold of us for any questions 5 Saturday, 24 December 11 5
  • 6. Timetable • Introduction to Java 7 (~35 mins) • BREAK (5 minutes) • Polyglot and functional programming (~50 mins) • BREAK (5 minutes) • Modern Java Concurrency (~60 mins) • Conclusion and Extra Q&A 6 Saturday, 24 December 11 6
  • 7. Real Developers code through bathroom breaks 7 Saturday, 24 December 11 7
  • 8. The Well-Grounded Java Developer... • Is not just a Java language whizz – Understands the basics of the JVM – Understands software development is a social activity – Utilises software craftsmanship approaches – Understands architecture • Is looking at Java 7 • • Is looking at polyglot and functional programming • Is looking at modern concurrency practices 8 Saturday, 24 December 11 8
  • 9. Java 7 - Why is it important • The WGJD wants to code rapidly • The WGJD wants to code concisely • The WGJD wants to take advantage of: – The compiler (including JIT) – The JVM • Java 7 gives you many improvements in these areas 9 Saturday, 24 December 11 9
  • 10. OpenJDK - The Java 7/8 split • 20 Sep 2010 - Mark Reinhold announces Plan B – Splits OpenJDK effort into Java 7 (July 2011) and Java 8 (2013) – Popular choice with the community • July 2011 - Java 7 goes gold • Some new features to be delayed until JDK 8 – Closures Lambdas SAM literals – Modularisation (aka Jigsaw) • JRockit features to be merged into OpenJDK – Enhanced management of the JVM – Ongoing merge of the VM engineering groups 10 Saturday, 24 December 11 10
  • 11. Contents of JDK 7 Release • Project Coin • NIO.2 • Method Handles • invokedynamic • Concurrency Refresh • Odds & Ends 11 Saturday, 24 December 11 11
  • 12. Project Coin • “Small” changes • Language Level, not VM • Stay away from the type system • Developed in a very OSS manner – Was an ‘interesting’ experience for all involved 12 Saturday, 24 December 11 12
  • 13. Project Coin - Highlights • Strings in switch • try-with-resources (aka ARM or TWR) • Diamond Syntax • Multicatch with precise rethrow • Enhanced syntax for numeric literals • Varargs / autoboxing warning 13 Saturday, 24 December 11 13
  • 14. Strings in switch • Code along exercise: FeedingSchedule.java 14 Saturday, 24 December 11 14
  • 15. try-with-resources 15 Saturday, 24 December 11 15
  • 16. Diamond syntax • Code along exercise: HordeOfOtters.java 16 Saturday, 24 December 11 16
  • 17. Personally I’d stick to Java 1.4 17 Saturday, 24 December 11 17
  • 18. NIO.2 - New I/O version 2 • A new file system and path abstraction • Based on Path – An abstract view of a ‘file like’ system • Files class contains many helper methods, including – File manipulation (copy, move, rename etc) – Walking directory trees – Native file system support (e.g. symbolic links) • Works with existing java.io.File code 18 Saturday, 24 December 11 18
  • 19. NIO.2 - New I/O version 2 • Asynchronous (non-blocking) I/O • For sockets and files • Mainly utilises java.util.concurrent.Future • New NetworkChannel – Socket/Channel construct – Binding, options and multicast 19 Saturday, 24 December 11 19
  • 20. Path and Files - Some examples • Code along exercise: Housekeeping.java 20 Saturday, 24 December 11 20
  • 21. URL stream to file - Java 6 style NIO 21 Saturday, 24 December 11 21
  • 22. URL stream to file in Java 7 • Code along exercise: VetNotes.java 22 Saturday, 24 December 11 22
  • 23. NIO.2 - Future base file I/O 23 Saturday, 24 December 11 23
  • 24. Monty Python eat your heart out 24 Saturday, 24 December 11 24
  • 25. Method Handles • We already have Reflection API – It’s all pretty horrible • JDK 7 introduces a new way to inspect at runtime • Method Handles – Represent the ability to call a method – Implement a subclass of java.lang.invoke.MethodHandle – Are strongly-typed and typesafe – Needed for invokedynamic - but also used standalone 25 Saturday, 24 December 11 25
  • 26. Example - ThreadPoolManager 26 Saturday, 24 December 11 26
  • 27. Cancelling using Reflection 27 Saturday, 24 December 11 27
  • 28. Cancelling using MethodHandle 28 Saturday, 24 December 11 28
  • 29. invokedynamic • invokedynamic is a key new JVM feature – It’s the first new bytecode since Java 1.0 – Joins invokevirtual, invokestatic, invokeinterface and invokespecial • Relaxes a key part of the static typing system – User code can determine dispatch at runtime • Aims to be as fast as regular method dispatch – e.g. invokevirtual • No Java syntax in Java 7 – But maybe for Java 8 29 Saturday, 24 December 11 29
  • 30. invokedynamic contd. • JRuby, Jython, Groovy, Clojure et al all benefit – JRuby gains a lot, Clojure not so much – Even Scala is using it now! • JRuby has been working closely with the JSR-292 team – Big wins – Makes JRuby enticing to Ruby developers • Java 8 also gets a boost – Lambdas have a much nicer design with invokedynamic 30 Saturday, 24 December 11 30
  • 31. Other JVM Languages? Meh - Use the Golden Hammer! 31 Saturday, 24 December 11 31
  • 32. Java 7 Concurrency Refresh • Java 7 has a number of new concurrency toys • The headline item is Fork / Join – similar to MapReduce, useful for a certain class of problems – fork and join executions are not necessarily threads • We’ll cover this in the final hour! 32 Saturday, 24 December 11 32
  • 33. Java 7 - That’s not all • Nimbus Look & Feel for Swing • New helper classes including Objects – .deepEquals() and friends • Enhanced JDBC (including try-with-resources support) • Better unicode support – Thanks in part to Tom Christiansen of Perl fame • More small changes in niche areas 33 Saturday, 24 December 11 33
  • 34. New Faces in the OpenJDK 34 Original Image by Acaben Saturday, 24 December 11 34
  • 35. What We Didn’t Have Time To Talk About • Java 8 – Java FX 2.0 • Java EE 6/7 • Java ME – Android and _that_ lawsuit • OpenJDK changes & JDK Enhancement Proposals (JEP) • Java Community Process (JCP) – Java Specification Requests (JSRs) – Java User Groups (JUGs) and reinvigorating the Community 35 Saturday, 24 December 11 35
  • 36. What? You still here? Go take a break will you! 36 Saturday, 24 December 11 36