SlideShare uma empresa Scribd logo
1 de 39
What’s New in Java 7?
A Glance at the Future




                         copyright 2009 Trainologic LTD
What’s New in Java 7?



• Java 7.
• Modularization
• JSR 308.
• Library Changes.
• Language Changes.
• Enhancements to the JVM.
• What’s Not Included.




                             copyright 2009 Trainologic LTD
What’s new in Java 7?



                What’s new in Java 7

• Scheduled release date: early 2010.
• No platform JSR yet.
• Many exciting new features.

• Lets go over them…




                           3
                                        copyright 2009 Trainologic LTD
What’s new in Java 7?



                  Changes in Java 7

• Modularization.
• Annotations on Types.
• Fork/Join Library.
• NIO2.
• Safe Re-throw.
• Null Dereference.
• Multi-catch.
• JVM Enhancements.
• …and more…


                          4
                                      copyright 2009 Trainologic LTD
What’s New in Java 7?



• Java 7.
• Modularization
  Modularization.
• JSR 308.
• Library Changes.
• Language Changes.
• Enhancements to the JVM.
• What’s Not Included.




                             copyright 2009 Trainologic LTD
What’s new in Java 7?



                        The JAR Hell

• JARs are archaic beasts headed for extinction.
• No version management.
• No dependencies mechanism.
• Don’t plug well into existing module-frameworks (e.g.
  OSGi).
• Don’t support encapsulation.




                             6
                                               copyright 2009 Trainologic LTD
What’s new in Java 7?



                   Introducing Modules

• The module keyword provides a new accessibility level
  to the standard levels (private, default/package,
  protected, public).
• Here is a an example of using module:

    module com.trainologic.services@4.1;
    package com.trainologic.modules.example;

    public class InnerService {
             //...
    }




                                     7
                                                 copyright 2009 Trainologic LTD
What’s new in Java 7?



                        Accessibility

• In the previous example, the InnerService class belongs
  to the module com.trainologic.services version 4.1
• This class is accessible from everywhere, it is public!.
• If the class or one of its members/constructors is
  declared module, it will only be accessible from a
  type that belongs to the same module.




                              8
                                                  copyright 2009 Trainologic LTD
What’s new in Java 7?



                  Module Meta-data

• With Java 5, we were able to provide package meta-
  data (annotations) by the use of the package-info.java
  file.
• With Java 7 we will be able to provide module meta-
  data with the module-info.java file.




                             9
                                                copyright 2009 Trainologic LTD
What’s new in Java 7?



                              Example

• module-info.java:
    module core provides infra {
             // Must have this module visible
             requires anotherModule;
             // Only this module will be able to require me.
             permits extensions;
    }




                                     10
                                                               copyright 2009 Trainologic LTD
What’s new in Java 7?



                        Project Jigsaw

• Project Jigsaw breaks the JDK into modules.
• This will enable using smaller JDK Jars in applications
  (based on needs).
• This will also be an excellent opportunity to get rid of
  deprecated APIs.




                              11
                                                   copyright 2009 Trainologic LTD
What’s New in Java 7?



• Java 7.
• Modularization
• JSR 308.
• Library Changes.
• Language Changes.
• Enhancements to the JVM.
• What’s Not Included.




                             copyright 2009 Trainologic LTD
What’s new in Java 7?



                            JSR 308

• JSR 308 will enhance the Java Annotations framework
  and will enable placing annotations in more places than
  available in Java 6.
• You can now place annotations on Types:

    List<@NonNull Object>




                               13
                                                copyright 2009 Trainologic LTD
What’s new in Java 7?



                        More Examples



     Map<@NonNull String, @NonEmpty List<@Readonly Document>> files;


     void monitorTemperature() throws @Critical TemperatureException
     {

     myString = (@NonNull String) myObject;

     class Folder<F extends @Existing File> { ... }

     Collection<? super @Existing File>




                                     14
                                                               copyright 2009 Trainologic LTD
What’s new in Java 7?



                     Method Receivers

• You can also apply annotations to the object on which
  the method is called:

    // The read method can be invoked only on an Opened object!
    public byte[] read() @Open { ... }

    // The configure method can be invoked
    // only on an object which is in Configuration state!
    public void configure(Map props) @Configuration { ... }




                                    15
                                                                  copyright 2009 Trainologic LTD
What’s new in Java 7?



                Annotations on Types

• This new feature will enable “Design by Contract”.
• It will enable new opportunities for static syntax
  checkers to find bugs.


• One of the exciting new features for Java 7!




                            16
                                                 copyright 2009 Trainologic LTD
What’s New in Java 7?



• Java 7.
• Modularization
• JSR 308.
• Library Changes.
• Language Changes.
• Enhancements to the JVM.
• What’s Not Included.




                             copyright 2009 Trainologic LTD
What’s new in Java 7?



                  Concurrency Utils

• Doug Lea, the founder of the excellent
  java.util.concurrent introduces (through JSR 166) the
  following new features:
    • Fork/Join framework.
    • TransferQueue.
    • Phasers.




                             18
                                                copyright 2009 Trainologic LTD
What’s new in Java 7?



                        Fork/Join

• The basic idea of the Fork/Join framework is that many
  tasks can be split to several concurrent threads, and the
  result should be merged back.


• Let’s take a look at an example…




                             19
                                                 copyright 2009 Trainologic LTD
What’s new in Java 7?



                              Fork/Join

• Instead of doing it single-threaded, the idea of fork/join
  is to split the operation to several (depends on the # of
  cores) concurrent threads.

      public class Fibonacci extends RecursiveTask<Integer> {
         private final int n;

          public Fibonacci(int n) { this.n = n;}
          protected Integer compute() {
                System.out.println(Thread.currentThread().getName());
                if (n <= 1)
                   return n;
                Fibonacci f1 = new Fibonacci(n - 1);
                f1.fork();
                Fibonacci f2 = new Fibonacci(n - 2);
                return f2.compute() + f1.join();
          }
      }


                                      20
                                                                copyright 2009 Trainologic LTD
What’s new in Java 7?



                              Example

• The Main class:

      public class Main {
         public static void main(String[] args) {
               ForkJoinPool pool = new ForkJoinPool(3);
               Fibonacci fibonacci = new Fibonacci(20);
               pool.execute(fibonacci);
               System.out.println(fibonacci.join());

          }
      }




                                     21
                                                          copyright 2009 Trainologic LTD
What’s new in Java 7?



                        TransferQueue

• A BlockingQueue on which the producers await for a
  consumer to take their elements.
• Usage scenarios are typically message passing
  applications.




                              22
                                                  copyright 2009 Trainologic LTD
What’s new in Java 7?



                         Phasers

• “Beam me up, Scotty!”
• A Phaser is quite similar to CyclicBarrier and
  CountDownLatch but is more powerful and flexible.
• A Phaser has an associated phase-number which is of
  type int.
• A Phaser has a number of unarrived parties. Unlike
  CyclicBarrier and CountDownLatch, this number is
  dynamic.




                             23
                                                   copyright 2009 Trainologic LTD
What’s new in Java 7?



                        Phasers

• A Phaser supports operations for arriving, awaiting,
  termination, deregistration and registration.
• When all the parties arrive, the Phaser advances
  (increments its phase-number).
• Phasers also supports ForkJoinTasks!




                             24
                                                  copyright 2009 Trainologic LTD
What’s new in Java 7?



                        NIO.2

• JSR 203 adds new APIs to the NIO package.
• Main features:
   • BigBuffers – Buffers that support more than
      Integer.MAX_VALUE elements.
    • Filesystem API.
    • Asynchronous Channels.




                            25
                                               copyright 2009 Trainologic LTD
What’s new in Java 7?



                         Filesystem API

• Here is an example of using events on filesystem:
     FileSystem fs = ...
     FileReference file = ...
       WatchService watcher = fs.newWatchService();
      file.register(watcher, WatchEvent.MODIFY_EVENT);
       for (;;) {
           WatchKey key = watcher.take();// wait for the next key
           List<WatchEvent> events = key.takeEvents();
           for (WatchEvent event: events) {
               if ((event & WatchEvent.MODIFY_EVENT) > 0) {
                   FileChannel fc = FileChannel.open(file,
                                   OpenFlag.READ);
                   FileLock lock = fc.lock();
                   // do something
                   lock.unlock();
                   fc.close();
               }
           }
           key.reset();
     }


                                     26
                                                                copyright 2009 Trainologic LTD
What’s New in Java 7?



• Java 7.
• Modularization
• JSR 308.
• Library Changes.
• Language Changes.
• Enhancements to the JVM.
• What’s Not Included.




                             copyright 2009 Trainologic LTD
What’s new in Java 7?



                           Multi-Catch

• Finally, we can treat several Exception types in one
  catch block:


        try {
             Class.forName(quot;Kukuquot;).newInstance();
        } catch (InstantiationException, IllegalAccessException e){
             e.printStackTrace();
        } catch (ClassNotFoundException e) {
             // do something else
        }




                                    28
                                                              copyright 2009 Trainologic LTD
What’s new in Java 7?



                         Safe Re-throw

• Currently the following code will not compile:

     public void foo() throws IOException, SQLException {
          try {
              // do something that may throw IOException or
              // SQLException
          } catch (Exception e) {
              // do something
              throw(e);
          }
      }




                                      29
                                                              copyright 2009 Trainologic LTD
What’s new in Java 7?



                         Safe Re-throw

• The proposed syntax is with the final keyword:

     public void foo() throws IOException, SQLException {
          try {
              // do something that may throw IOException or
              // SQLException
          } catch (final Exception e) {
              // do something
              throw(e);
          }
      }




                                      30
                                                              copyright 2009 Trainologic LTD
What’s new in Java 7?



                  Null-safe Dereference

• A new operator will be introduced:
    currentCompany?.getCEO()?.getAddress()?.getStreet()




                                     31
                                                          copyright 2009 Trainologic LTD
What’s new in Java 7?



                        Type Inference

• How about easing the cumbersome generic-types
  initialization?

    Map<String, Integer> map = new HashMap<String, Integer>();


 • Now it will be:
    Map<String, Integer> map = new HashMap<>();




                                     32
                                                                 copyright 2009 Trainologic LTD
What’s New in Java 7?



• Java 7.
• Modularization
• JSR 308.
• Library Changes.
• Language Changes.
• Enhancements to the JVM.
• What’s Not Included.




                             copyright 2009 Trainologic LTD
What’s new in Java 7?



                 Garbage First (G1)

• A new Garbage Collector is developed by Sun for Java 7.
• It will be called G1.
• This GC will split the memory into multiple regions
  (unlike 2 in the current version) and will (most likely)
  perform faster than the current parallel collectors.




                              34
                                                  copyright 2009 Trainologic LTD
What’s new in Java 7?



           Compressed 64-bit Pointers

• One of the downsides of a 64-bit JVM is that low level
  pointers take a lot of space.
• Java7 will include a “compressed 64-bit pointers” that
  will consume less space and perform just like 32-bit
  pointers.




                             35
                                                copyright 2009 Trainologic LTD
What’s new in Java 7?



                    InvokeDynamic

• A new bytecode instruction will (finally) be added to the
  JVM bytecode.
• This new instruction will greatly simplify dynamic
  languages implementations on the JVM.


• Dynamic Language?? – Watch for the Groovy
  presentation!!




                             36
                                                 copyright 2009 Trainologic LTD
What’s New in Java 7?



• Java 7.
• Modularization
• JSR 308.
• Library Changes.
• Language Changes.
• Enhancements to the JVM.
• What’s Not Included
             Included.




                             copyright 2009 Trainologic LTD
What’s new in Java 7?



                        Not Included

• The following (promised) features will not be included in
  Java 7:
    • Closures.
    • Refied Generics.
    • Properties.
    • Operator overloading.
    • BigDecimal syntax.
    • Language level XML support.



                             38
                                                copyright 2009 Trainologic LTD
Thank You



            Q&A
             Shimi Bandiel,

             VP R&D, Trainologic LTD




                  copyright 2008 trainologic LTD

Mais conteúdo relacionado

Mais procurados

Java 10 New Features
Java 10 New FeaturesJava 10 New Features
Java 10 New FeaturesAli BAKAN
 
Managing Change
Managing ChangeManaging Change
Managing ChangeMirko Jahn
 
Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web ToolkitJeppe Rishede
 
CompletableFuture уже здесь
CompletableFuture уже здесьCompletableFuture уже здесь
CompletableFuture уже здесьDmitry Chuyko
 
50+ java interview questions
50+ java interview questions50+ java interview questions
50+ java interview questionsSynergisticMedia
 
Java EE | Modular EJBs for Enterprise OSGi | Tim Ward
Java EE | Modular EJBs for Enterprise OSGi | Tim WardJava EE | Modular EJBs for Enterprise OSGi | Tim Ward
Java EE | Modular EJBs for Enterprise OSGi | Tim WardJAX London
 
Java EE 7 for Real Enterprise Systems
Java EE 7 for Real Enterprise SystemsJava EE 7 for Real Enterprise Systems
Java EE 7 for Real Enterprise SystemsHirofumi Iwasaki
 
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFishOSGi & Java EE in GlassFish
OSGi & Java EE in GlassFishSanjeeb Sahoo
 
Open Services Gateway Initiative (OSGI)
Open Services Gateway Initiative (OSGI)Open Services Gateway Initiative (OSGI)
Open Services Gateway Initiative (OSGI)Peter R. Egli
 
OSGi in 5 minutes
OSGi in 5 minutesOSGi in 5 minutes
OSGi in 5 minutesSerge Huber
 
Highlights from Java 10, 11 and 12 and Future of Java at JUG Koblenz
Highlights from Java 10, 11 and 12 and Future of Java at JUG KoblenzHighlights from Java 10, 11 and 12 and Future of Java at JUG Koblenz
Highlights from Java 10, 11 and 12 and Future of Java at JUG KoblenzVadym Kazulkin
 
Java interview-questions-and-answers
Java interview-questions-and-answersJava interview-questions-and-answers
Java interview-questions-and-answersbestonlinetrainers
 
Dev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdetDev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdetdevlabsalliance
 

Mais procurados (20)

Hotspot & AOT
Hotspot & AOTHotspot & AOT
Hotspot & AOT
 
Extending and scripting PDT
Extending and scripting PDTExtending and scripting PDT
Extending and scripting PDT
 
Intro To OSGi
Intro To OSGiIntro To OSGi
Intro To OSGi
 
Java 10 New Features
Java 10 New FeaturesJava 10 New Features
Java 10 New Features
 
Java7
Java7Java7
Java7
 
Managing Change
Managing ChangeManaging Change
Managing Change
 
Introduction to Google Web Toolkit
Introduction to Google Web ToolkitIntroduction to Google Web Toolkit
Introduction to Google Web Toolkit
 
CompletableFuture уже здесь
CompletableFuture уже здесьCompletableFuture уже здесь
CompletableFuture уже здесь
 
50+ java interview questions
50+ java interview questions50+ java interview questions
50+ java interview questions
 
Java EE | Modular EJBs for Enterprise OSGi | Tim Ward
Java EE | Modular EJBs for Enterprise OSGi | Tim WardJava EE | Modular EJBs for Enterprise OSGi | Tim Ward
Java EE | Modular EJBs for Enterprise OSGi | Tim Ward
 
Java EE 7 for Real Enterprise Systems
Java EE 7 for Real Enterprise SystemsJava EE 7 for Real Enterprise Systems
Java EE 7 for Real Enterprise Systems
 
OSGi overview
OSGi overviewOSGi overview
OSGi overview
 
OSGi & Java EE in GlassFish
OSGi & Java EE in GlassFishOSGi & Java EE in GlassFish
OSGi & Java EE in GlassFish
 
Open Services Gateway Initiative (OSGI)
Open Services Gateway Initiative (OSGI)Open Services Gateway Initiative (OSGI)
Open Services Gateway Initiative (OSGI)
 
OSGi in 5 minutes
OSGi in 5 minutesOSGi in 5 minutes
OSGi in 5 minutes
 
OSGi Blueprint Services
OSGi Blueprint ServicesOSGi Blueprint Services
OSGi Blueprint Services
 
Highlights from Java 10, 11 and 12 and Future of Java at JUG Koblenz
Highlights from Java 10, 11 and 12 and Future of Java at JUG KoblenzHighlights from Java 10, 11 and 12 and Future of Java at JUG Koblenz
Highlights from Java 10, 11 and 12 and Future of Java at JUG Koblenz
 
Intro to OSGi
Intro to OSGiIntro to OSGi
Intro to OSGi
 
Java interview-questions-and-answers
Java interview-questions-and-answersJava interview-questions-and-answers
Java interview-questions-and-answers
 
Dev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdetDev labs alliance top 20 basic java interview question for sdet
Dev labs alliance top 20 basic java interview question for sdet
 

Semelhante a What's Expected in Java 7

What's new in Java EE 6
What's new in Java EE 6What's new in Java EE 6
What's new in Java EE 6Gal Marder
 
Why should i switch to Java SE 7
Why should i switch to Java SE 7Why should i switch to Java SE 7
Why should i switch to Java SE 7Vinay H G
 
Java 9 New Features
Java 9 New FeaturesJava 9 New Features
Java 9 New FeaturesAli BAKAN
 
Java 9 features
Java 9 featuresJava 9 features
Java 9 featuresshrinath97
 
Inside IBM Java 7
Inside IBM Java 7Inside IBM Java 7
Inside IBM Java 7Tim Ellison
 
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010Arun Gupta
 
Features java9
Features java9Features java9
Features java9srmohan06
 
Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.Alexandre (Shura) Iline
 
Preparing your code for Java 9
Preparing your code for Java 9Preparing your code for Java 9
Preparing your code for Java 9Deepu Xavier
 
TDC 2011: OSGi-enabled Java EE Application
TDC 2011: OSGi-enabled Java EE ApplicationTDC 2011: OSGi-enabled Java EE Application
TDC 2011: OSGi-enabled Java EE ApplicationArun Gupta
 
Javascript training sample
Javascript training sampleJavascript training sample
Javascript training sampleprahalad_das_in
 
Java Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, HibernateJava Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, HibernateAnton Keks
 
Java 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the GalleryJava 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the Gallerynjbartlett
 
Batch Applications for the Java Platform
Batch Applications for the Java PlatformBatch Applications for the Java Platform
Batch Applications for the Java PlatformSivakumar Thyagarajan
 
OSGi-enabled Java EE Applications using GlassFish
OSGi-enabled Java EE Applications using GlassFishOSGi-enabled Java EE Applications using GlassFish
OSGi-enabled Java EE Applications using GlassFishArun Gupta
 
Building Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integrationBuilding Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integrationFredrik Öhrström
 

Semelhante a What's Expected in Java 7 (20)

What's new in Java EE 6
What's new in Java EE 6What's new in Java EE 6
What's new in Java EE 6
 
Why should i switch to Java SE 7
Why should i switch to Java SE 7Why should i switch to Java SE 7
Why should i switch to Java SE 7
 
Java 9 New Features
Java 9 New FeaturesJava 9 New Features
Java 9 New Features
 
Modularization in java 8
Modularization in java 8Modularization in java 8
Modularization in java 8
 
Java 9 features
Java 9 featuresJava 9 features
Java 9 features
 
Inside IBM Java 7
Inside IBM Java 7Inside IBM Java 7
Inside IBM Java 7
 
Java Cloud and Container Ready
Java Cloud and Container ReadyJava Cloud and Container Ready
Java Cloud and Container Ready
 
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
OSGi & Java EE in GlassFish @ Silicon Valley Code Camp 2010
 
Features java9
Features java9Features java9
Features java9
 
JavaYDL18
JavaYDL18JavaYDL18
JavaYDL18
 
Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.Java code coverage with JCov. Implementation details and use cases.
Java code coverage with JCov. Implementation details and use cases.
 
Preparing your code for Java 9
Preparing your code for Java 9Preparing your code for Java 9
Preparing your code for Java 9
 
JDK 10 Java Module System
JDK 10 Java Module SystemJDK 10 Java Module System
JDK 10 Java Module System
 
TDC 2011: OSGi-enabled Java EE Application
TDC 2011: OSGi-enabled Java EE ApplicationTDC 2011: OSGi-enabled Java EE Application
TDC 2011: OSGi-enabled Java EE Application
 
Javascript training sample
Javascript training sampleJavascript training sample
Javascript training sample
 
Java Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, HibernateJava Course 15: Ant, Scripting, Spring, Hibernate
Java Course 15: Ant, Scripting, Spring, Hibernate
 
Java 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the GalleryJava 7 Modularity: a View from the Gallery
Java 7 Modularity: a View from the Gallery
 
Batch Applications for the Java Platform
Batch Applications for the Java PlatformBatch Applications for the Java Platform
Batch Applications for the Java Platform
 
OSGi-enabled Java EE Applications using GlassFish
OSGi-enabled Java EE Applications using GlassFishOSGi-enabled Java EE Applications using GlassFish
OSGi-enabled Java EE Applications using GlassFish
 
Building Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integrationBuilding Large Java Projects Faster: Multicore javac and Makefile integration
Building Large Java Projects Faster: Multicore javac and Makefile integration
 

Mais de Gal Marder

Should i break it?
Should i break it?Should i break it?
Should i break it?Gal Marder
 
Reactive Micro Services with Java seminar
Reactive Micro Services with Java seminarReactive Micro Services with Java seminar
Reactive Micro Services with Java seminarGal Marder
 
JVM languages "flame wars"
JVM languages "flame wars"JVM languages "flame wars"
JVM languages "flame wars"Gal Marder
 
Dive into spark2
Dive into spark2Dive into spark2
Dive into spark2Gal Marder
 
Stream processing from single node to a cluster
Stream processing from single node to a clusterStream processing from single node to a cluster
Stream processing from single node to a clusterGal Marder
 
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...Gal Marder
 
Spark real world use cases and optimizations
Spark real world use cases and optimizationsSpark real world use cases and optimizations
Spark real world use cases and optimizationsGal Marder
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9Gal Marder
 
What’s expected in Spring 5
What’s expected in Spring 5What’s expected in Spring 5
What’s expected in Spring 5Gal Marder
 
Multi-threading in the modern era: Vertx Akka and Quasar
Multi-threading in the modern era: Vertx Akka and QuasarMulti-threading in the modern era: Vertx Akka and Quasar
Multi-threading in the modern era: Vertx Akka and QuasarGal Marder
 

Mais de Gal Marder (10)

Should i break it?
Should i break it?Should i break it?
Should i break it?
 
Reactive Micro Services with Java seminar
Reactive Micro Services with Java seminarReactive Micro Services with Java seminar
Reactive Micro Services with Java seminar
 
JVM languages "flame wars"
JVM languages "flame wars"JVM languages "flame wars"
JVM languages "flame wars"
 
Dive into spark2
Dive into spark2Dive into spark2
Dive into spark2
 
Stream processing from single node to a cluster
Stream processing from single node to a clusterStream processing from single node to a cluster
Stream processing from single node to a cluster
 
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
Implementing Micro Services Tasks (service discovery, load balancing etc.) - ...
 
Spark real world use cases and optimizations
Spark real world use cases and optimizationsSpark real world use cases and optimizations
Spark real world use cases and optimizations
 
What’s expected in Java 9
What’s expected in Java 9What’s expected in Java 9
What’s expected in Java 9
 
What’s expected in Spring 5
What’s expected in Spring 5What’s expected in Spring 5
What’s expected in Spring 5
 
Multi-threading in the modern era: Vertx Akka and Quasar
Multi-threading in the modern era: Vertx Akka and QuasarMulti-threading in the modern era: Vertx Akka and Quasar
Multi-threading in the modern era: Vertx Akka and Quasar
 

Último

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 Processorsdebabhi2
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 

Último (20)

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
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 

What's Expected in Java 7

  • 1. What’s New in Java 7? A Glance at the Future copyright 2009 Trainologic LTD
  • 2. What’s New in Java 7? • Java 7. • Modularization • JSR 308. • Library Changes. • Language Changes. • Enhancements to the JVM. • What’s Not Included. copyright 2009 Trainologic LTD
  • 3. What’s new in Java 7? What’s new in Java 7 • Scheduled release date: early 2010. • No platform JSR yet. • Many exciting new features. • Lets go over them… 3 copyright 2009 Trainologic LTD
  • 4. What’s new in Java 7? Changes in Java 7 • Modularization. • Annotations on Types. • Fork/Join Library. • NIO2. • Safe Re-throw. • Null Dereference. • Multi-catch. • JVM Enhancements. • …and more… 4 copyright 2009 Trainologic LTD
  • 5. What’s New in Java 7? • Java 7. • Modularization Modularization. • JSR 308. • Library Changes. • Language Changes. • Enhancements to the JVM. • What’s Not Included. copyright 2009 Trainologic LTD
  • 6. What’s new in Java 7? The JAR Hell • JARs are archaic beasts headed for extinction. • No version management. • No dependencies mechanism. • Don’t plug well into existing module-frameworks (e.g. OSGi). • Don’t support encapsulation. 6 copyright 2009 Trainologic LTD
  • 7. What’s new in Java 7? Introducing Modules • The module keyword provides a new accessibility level to the standard levels (private, default/package, protected, public). • Here is a an example of using module: module com.trainologic.services@4.1; package com.trainologic.modules.example; public class InnerService { //... } 7 copyright 2009 Trainologic LTD
  • 8. What’s new in Java 7? Accessibility • In the previous example, the InnerService class belongs to the module com.trainologic.services version 4.1 • This class is accessible from everywhere, it is public!. • If the class or one of its members/constructors is declared module, it will only be accessible from a type that belongs to the same module. 8 copyright 2009 Trainologic LTD
  • 9. What’s new in Java 7? Module Meta-data • With Java 5, we were able to provide package meta- data (annotations) by the use of the package-info.java file. • With Java 7 we will be able to provide module meta- data with the module-info.java file. 9 copyright 2009 Trainologic LTD
  • 10. What’s new in Java 7? Example • module-info.java: module core provides infra { // Must have this module visible requires anotherModule; // Only this module will be able to require me. permits extensions; } 10 copyright 2009 Trainologic LTD
  • 11. What’s new in Java 7? Project Jigsaw • Project Jigsaw breaks the JDK into modules. • This will enable using smaller JDK Jars in applications (based on needs). • This will also be an excellent opportunity to get rid of deprecated APIs. 11 copyright 2009 Trainologic LTD
  • 12. What’s New in Java 7? • Java 7. • Modularization • JSR 308. • Library Changes. • Language Changes. • Enhancements to the JVM. • What’s Not Included. copyright 2009 Trainologic LTD
  • 13. What’s new in Java 7? JSR 308 • JSR 308 will enhance the Java Annotations framework and will enable placing annotations in more places than available in Java 6. • You can now place annotations on Types: List<@NonNull Object> 13 copyright 2009 Trainologic LTD
  • 14. What’s new in Java 7? More Examples Map<@NonNull String, @NonEmpty List<@Readonly Document>> files; void monitorTemperature() throws @Critical TemperatureException { myString = (@NonNull String) myObject; class Folder<F extends @Existing File> { ... } Collection<? super @Existing File> 14 copyright 2009 Trainologic LTD
  • 15. What’s new in Java 7? Method Receivers • You can also apply annotations to the object on which the method is called: // The read method can be invoked only on an Opened object! public byte[] read() @Open { ... } // The configure method can be invoked // only on an object which is in Configuration state! public void configure(Map props) @Configuration { ... } 15 copyright 2009 Trainologic LTD
  • 16. What’s new in Java 7? Annotations on Types • This new feature will enable “Design by Contract”. • It will enable new opportunities for static syntax checkers to find bugs. • One of the exciting new features for Java 7! 16 copyright 2009 Trainologic LTD
  • 17. What’s New in Java 7? • Java 7. • Modularization • JSR 308. • Library Changes. • Language Changes. • Enhancements to the JVM. • What’s Not Included. copyright 2009 Trainologic LTD
  • 18. What’s new in Java 7? Concurrency Utils • Doug Lea, the founder of the excellent java.util.concurrent introduces (through JSR 166) the following new features: • Fork/Join framework. • TransferQueue. • Phasers. 18 copyright 2009 Trainologic LTD
  • 19. What’s new in Java 7? Fork/Join • The basic idea of the Fork/Join framework is that many tasks can be split to several concurrent threads, and the result should be merged back. • Let’s take a look at an example… 19 copyright 2009 Trainologic LTD
  • 20. What’s new in Java 7? Fork/Join • Instead of doing it single-threaded, the idea of fork/join is to split the operation to several (depends on the # of cores) concurrent threads. public class Fibonacci extends RecursiveTask<Integer> { private final int n; public Fibonacci(int n) { this.n = n;} protected Integer compute() { System.out.println(Thread.currentThread().getName()); if (n <= 1) return n; Fibonacci f1 = new Fibonacci(n - 1); f1.fork(); Fibonacci f2 = new Fibonacci(n - 2); return f2.compute() + f1.join(); } } 20 copyright 2009 Trainologic LTD
  • 21. What’s new in Java 7? Example • The Main class: public class Main { public static void main(String[] args) { ForkJoinPool pool = new ForkJoinPool(3); Fibonacci fibonacci = new Fibonacci(20); pool.execute(fibonacci); System.out.println(fibonacci.join()); } } 21 copyright 2009 Trainologic LTD
  • 22. What’s new in Java 7? TransferQueue • A BlockingQueue on which the producers await for a consumer to take their elements. • Usage scenarios are typically message passing applications. 22 copyright 2009 Trainologic LTD
  • 23. What’s new in Java 7? Phasers • “Beam me up, Scotty!” • A Phaser is quite similar to CyclicBarrier and CountDownLatch but is more powerful and flexible. • A Phaser has an associated phase-number which is of type int. • A Phaser has a number of unarrived parties. Unlike CyclicBarrier and CountDownLatch, this number is dynamic. 23 copyright 2009 Trainologic LTD
  • 24. What’s new in Java 7? Phasers • A Phaser supports operations for arriving, awaiting, termination, deregistration and registration. • When all the parties arrive, the Phaser advances (increments its phase-number). • Phasers also supports ForkJoinTasks! 24 copyright 2009 Trainologic LTD
  • 25. What’s new in Java 7? NIO.2 • JSR 203 adds new APIs to the NIO package. • Main features: • BigBuffers – Buffers that support more than Integer.MAX_VALUE elements. • Filesystem API. • Asynchronous Channels. 25 copyright 2009 Trainologic LTD
  • 26. What’s new in Java 7? Filesystem API • Here is an example of using events on filesystem: FileSystem fs = ... FileReference file = ... WatchService watcher = fs.newWatchService(); file.register(watcher, WatchEvent.MODIFY_EVENT); for (;;) { WatchKey key = watcher.take();// wait for the next key List<WatchEvent> events = key.takeEvents(); for (WatchEvent event: events) { if ((event & WatchEvent.MODIFY_EVENT) > 0) { FileChannel fc = FileChannel.open(file, OpenFlag.READ); FileLock lock = fc.lock(); // do something lock.unlock(); fc.close(); } } key.reset(); } 26 copyright 2009 Trainologic LTD
  • 27. What’s New in Java 7? • Java 7. • Modularization • JSR 308. • Library Changes. • Language Changes. • Enhancements to the JVM. • What’s Not Included. copyright 2009 Trainologic LTD
  • 28. What’s new in Java 7? Multi-Catch • Finally, we can treat several Exception types in one catch block: try { Class.forName(quot;Kukuquot;).newInstance(); } catch (InstantiationException, IllegalAccessException e){ e.printStackTrace(); } catch (ClassNotFoundException e) { // do something else } 28 copyright 2009 Trainologic LTD
  • 29. What’s new in Java 7? Safe Re-throw • Currently the following code will not compile: public void foo() throws IOException, SQLException { try { // do something that may throw IOException or // SQLException } catch (Exception e) { // do something throw(e); } } 29 copyright 2009 Trainologic LTD
  • 30. What’s new in Java 7? Safe Re-throw • The proposed syntax is with the final keyword: public void foo() throws IOException, SQLException { try { // do something that may throw IOException or // SQLException } catch (final Exception e) { // do something throw(e); } } 30 copyright 2009 Trainologic LTD
  • 31. What’s new in Java 7? Null-safe Dereference • A new operator will be introduced: currentCompany?.getCEO()?.getAddress()?.getStreet() 31 copyright 2009 Trainologic LTD
  • 32. What’s new in Java 7? Type Inference • How about easing the cumbersome generic-types initialization? Map<String, Integer> map = new HashMap<String, Integer>(); • Now it will be: Map<String, Integer> map = new HashMap<>(); 32 copyright 2009 Trainologic LTD
  • 33. What’s New in Java 7? • Java 7. • Modularization • JSR 308. • Library Changes. • Language Changes. • Enhancements to the JVM. • What’s Not Included. copyright 2009 Trainologic LTD
  • 34. What’s new in Java 7? Garbage First (G1) • A new Garbage Collector is developed by Sun for Java 7. • It will be called G1. • This GC will split the memory into multiple regions (unlike 2 in the current version) and will (most likely) perform faster than the current parallel collectors. 34 copyright 2009 Trainologic LTD
  • 35. What’s new in Java 7? Compressed 64-bit Pointers • One of the downsides of a 64-bit JVM is that low level pointers take a lot of space. • Java7 will include a “compressed 64-bit pointers” that will consume less space and perform just like 32-bit pointers. 35 copyright 2009 Trainologic LTD
  • 36. What’s new in Java 7? InvokeDynamic • A new bytecode instruction will (finally) be added to the JVM bytecode. • This new instruction will greatly simplify dynamic languages implementations on the JVM. • Dynamic Language?? – Watch for the Groovy presentation!! 36 copyright 2009 Trainologic LTD
  • 37. What’s New in Java 7? • Java 7. • Modularization • JSR 308. • Library Changes. • Language Changes. • Enhancements to the JVM. • What’s Not Included Included. copyright 2009 Trainologic LTD
  • 38. What’s new in Java 7? Not Included • The following (promised) features will not be included in Java 7: • Closures. • Refied Generics. • Properties. • Operator overloading. • BigDecimal syntax. • Language level XML support. 38 copyright 2009 Trainologic LTD
  • 39. Thank You Q&A Shimi Bandiel, VP R&D, Trainologic LTD copyright 2008 trainologic LTD